Skip to content

Commit

Permalink
asix: fix infinite loop in rx_fixup()
Browse files Browse the repository at this point in the history
commit 6c15d74 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>
  • Loading branch information
Aurelien Jacobs authored and Greg Kroah-Hartman committed Jan 12, 2012
1 parent 49ffa26 commit 2643bce
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/usb/asix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2643bce

Please sign in to comment.