[PATCH 09/10] net: usb: smsc95xx: fix handling of multiple packets per urb

Ahmad Fatoum a.fatoum at pengutronix.de
Thu Apr 4 11:40:00 PDT 2024


len is the actual length of the USB bulk transfer, while size is the
length of the current packet, which may be different if we have multiple
packets per transfer.

We don't seem to run into this in barebox, perhaps because of our MTU,
but let's fix it anyway.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/net/usb/smsc95xx.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 1587128368ad..291e3c2f80f7 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -790,14 +790,17 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, void *buf, int len)
 				return 1;
 			}
 
-			net_receive(&dev->edev, packet, len - 4);
+			net_receive(&dev->edev, packet, size - 4);
 		}
 
 		len -= size;
+		buf += size;
 
 		/* padding bytes before the next frame starts */
-		if (len)
+		if (len) {
 			len -= align_count;
+			buf += size;
+		}
 	}
 
 	if (len < 0) {
-- 
2.39.2




More information about the barebox mailing list