]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
asix: fix infinite loop in rx_fixup()
authorAurelien Jacobs <aurel@gnuage.org>
Sat, 7 Jan 2012 20:15:16 +0000 (12:15 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 12 Jan 2012 19:33:42 +0000 (11:33 -0800)
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@gnuage.org>
Cc: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/asix.c

index c50632e8658cb771036dea3a7b07ea7a0bc77ab8..7105577000955eff6de0c9e7e7b6b2a11753d1de 100644 (file)
@@ -371,7 +371,7 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 
                skb_pull(skb, (size + 1) & 0xfffe);
 
-               if (skb->len == 0)
+               if (skb->len < sizeof(header))
                        break;
 
                head = (u8 *) skb->data;