[PATCH 5.14 378/432] usb: isp1760: fix qtd fill length
From: Greg Kroah-Hartman
Date: Thu Sep 16 2021 - 13:51:44 EST
From: Rui Miguel Silva <rui.silva@xxxxxxxxxx>
[ Upstream commit cbfa3effdf5c2d411c9ce9820f3d33d77bc4697d ]
When trying to send bulks bigger than the biggest block size
we need to split them over several qtd. Fix this limiting the
maximum qtd size to largest block size.
Reported-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Tested-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Signed-off-by: Rui Miguel Silva <rui.silva@xxxxxxxxxx>
Link: https://lore.kernel.org/r/20210827131154.4151862-3-rui.silva@xxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>
---
drivers/usb/isp1760/isp1760-hcd.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/isp1760/isp1760-hcd.c b/drivers/usb/isp1760/isp1760-hcd.c
index ffb3a0c8c909..d2d19548241e 100644
--- a/drivers/usb/isp1760/isp1760-hcd.c
+++ b/drivers/usb/isp1760/isp1760-hcd.c
@@ -1826,9 +1826,11 @@ static void packetize_urb(struct usb_hcd *hcd,
goto cleanup;
if (len > mem->blocks_size[ISP176x_BLOCK_NUM - 1])
- len = mem->blocks_size[ISP176x_BLOCK_NUM - 1];
+ this_qtd_len = mem->blocks_size[ISP176x_BLOCK_NUM - 1];
+ else
+ this_qtd_len = len;
- this_qtd_len = qtd_fill(qtd, buf, len);
+ this_qtd_len = qtd_fill(qtd, buf, this_qtd_len);
list_add_tail(&qtd->qtd_list, head);
len -= this_qtd_len;
--
2.30.2