[PATCH] zd1201: avoid null ptr access of skb->dev
authorJohn W. Linville <linville@tuxdriver.com>
Wed, 17 Oct 2007 21:07:12 +0000 (17:07 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 18 Oct 2007 19:21:47 +0000 (15:21 -0400)
skb->dev is not set until eth_type_trans is called...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/zd1201.c

index 935b144d9b56b419959fd3bd40cf156aa4121ca1..d5c0c66188cad3d146e32e3b0c6ccf0012e3066a 100644 (file)
@@ -327,8 +327,8 @@ static void zd1201_usbrx(struct urb *urb)
                        memcpy(skb_put(skb, 6), &data[datalen-8], 6);
                        memcpy(skb_put(skb, 2), &data[datalen-24], 2);
                        memcpy(skb_put(skb, len), data, len);
-                       skb->dev->last_rx = jiffies;
                        skb->protocol = eth_type_trans(skb, zd->dev);
+                       skb->dev->last_rx = jiffies;
                        zd->stats.rx_packets++;
                        zd->stats.rx_bytes += skb->len;
                        netif_rx(skb);
@@ -384,8 +384,8 @@ static void zd1201_usbrx(struct urb *urb)
                        memcpy(skb_put(skb, 2), &data[6], 2);
                        memcpy(skb_put(skb, len), data+8, len);
                }
-               skb->dev->last_rx = jiffies;
                skb->protocol = eth_type_trans(skb, zd->dev);
+               skb->dev->last_rx = jiffies;
                zd->stats.rx_packets++;
                zd->stats.rx_bytes += skb->len;
                netif_rx(skb);