From: Ivo van Doorn Date: Sat, 5 Jul 2008 13:11:57 +0000 (+0200) Subject: rt2x00: Fix NULL pointer error in adhoc/master mode X-Git-Tag: v2.6.27-rc1~969^2~159^2~32 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a613195123ab2c2400004c7aaee4d25f3b8ae52;p=linux-2.6 rt2x00: Fix NULL pointer error in adhoc/master mode As soon as an interface is enabled, and that interface is in adhoc or master mode, the device will start raising beacondone interrupts. But before the first interrupt is raised, mac80211 will probably not have send any beacons to the device yet, which results in a NULL pointer error when the skb is being freed. Note that the "raise beacondone interrupts without a beacon" is also a bug, and will be addressed later. The more important bug however is preventing the NULL pointer failt itself, since there might be other conditions that could trigger it as well. Signed-off-by: Ivo van Doorn Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index 3ddce538ef..ecf57f8f34 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c @@ -108,6 +108,9 @@ void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb) { + if (!skb) + return; + rt2x00queue_unmap_skb(rt2x00dev, skb); dev_kfree_skb_any(skb); }