Skip to contentSkip to conversation

asix: fix infinite loop in rx_fixup()

PATCH Applied Aurelien Jacobs 2 participants 2 messages Jan 7, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 asix: fix infinite loop in rx_fixup()

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.

---
 drivers/net/usb/asix.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/usb/asix.c +1 -1
index dbdca22..df2b08d 100644
@@ -374,11 +374,11 @@ static int asix_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
 			return 0;
 		}
 
 		skb_pull(skb, (size + 1) & 0xfffe);
 
-		if (skb->len == 0)
+		if (skb->len < sizeof(header))
 			break;
 
 		head = (u8 *) skb->data;
 		memcpy(&header, head, sizeof(header));
 		le32_to_cpus(&header);
Signature · 1 line
1.7.8.2
maintainer Applied
#1 lore raw

From: Aurelien Jacobs <[email protected]>
Date: Sat, 7 Jan 2012 19:09:27 +0100

Quoted 9 lines

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.

Applied, thanks.