Return-path: Received: from ra.tuxdriver.com ([70.61.120.52]:3962 "EHLO ra.tuxdriver.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752893AbXJZVGv (ORCPT ); Fri, 26 Oct 2007 17:06:51 -0400 From: "John W. Linville" To: stable@kernel.org Cc: linux-wireless@vger.kernel.org, "John W. Linville" Subject: [PATCH] zd1201: avoid null ptr access of skb->dev Date: Fri, 26 Oct 2007 17:04:36 -0400 Message-Id: <11934326821662-git-send-email-linville@tuxdriver.com> (sfid-20071026_220654_434405_EB9234B1) In-Reply-To: <11934326823109-git-send-email-linville@tuxdriver.com> References: <11934326793639-git-send-email-linville@tuxdriver.com> <11934326801557-git-send-email-linville@tuxdriver.com> <11934326803769-git-send-email-linville@tuxdriver.com> <11934326803330-git-send-email-linville@tuxdriver.com> <11934326811535-git-send-email-linville@tuxdriver.com> <11934326813508-git-send-email-linville@tuxdriver.com> <1193432681145-git-send-email-linville@tuxdriver.com> <11934326812028-git-send-email-linville@tuxdriver.com> <11934326813245-git-send-email-linville@tuxdriver.com> <11934326823646-git-send-email-linville@tuxdriver.com> <11934326821301-git-send-email-linville@tuxdriver.com> <11934326823109-git-send-email-linville@tuxdriver.com> Sender: linux-wireless-owner@vger.kernel.org List-ID: From: John W. Linville skb->dev is not set until eth_type_trans is called... Signed-off-by: John W. Linville --- drivers/net/wireless/zd1201.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c index 935b144..d5c0c66 100644 --- a/drivers/net/wireless/zd1201.c +++ b/drivers/net/wireless/zd1201.c @@ -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); -- 1.5.2.4