[16/20] asix: fix infinite loop in rx_fixup()

From: Greg KH
Date: Tue Jan 10 2012 - 15:11:40 EST


2.6.32-longterm review patch. If anyone has any objections, please let me know.

------------------

From: Aurelien Jacobs <aurel@xxxxxxxxxx>

commit 6c15d74defd38e7e7f8805392578b7a1d508097e upstream.

At this point if skb->len happens to be 2, the subsequant skb_pull(skb, 4)
call won't work and the skb->len won't be decreased and won't ever reach 0,
resulting in an infinite loop.

With an ASIX 88772 under heavy load, without this patch, rx_fixup() reaches
an infinite loop in less than a minute. With this patch applied,
no infinite loop even after hours of heavy load.

Signed-off-by: Aurelien Jacobs <aurel@xxxxxxxxxx>
Cc: Jussi Kivilinna <jussi.kivilinna@xxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>

---
drivers/net/usb/asix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -339,7 +339,7 @@ static int asix_rx_fixup(struct usbnet *

skb_pull(skb, (size + 1) & 0xfffe);

- if (skb->len == 0)
+ if (skb->len < sizeof(header))
break;

head = (u8 *) skb->data;


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/