Skip to contentSkip to conversation

mac80211: fix bug in ieee80211_build_probe_req

PATCH New Johannes Berg 1 participant 1 message Nov 8, 2011 mac80211

lore
Share & tools
lore

Johannes Berg

author maintainer
#0 lore raw

PATCH 1/1 mac80211: fix bug in ieee80211_build_probe_req

From: Johannes Berg <[email protected]>

ieee80211_probereq_get() can return NULL in
which case we should clean up & return NULL
in ieee80211_build_probe_req() as well.

---
 net/mac80211/util.c |    4 ++++
 1 file changed, 4 insertions(+)
net/mac80211/util.c +4 -0
@@ -880,6 +880,8 @@ struct sk_buff *ieee80211_build_probe_re
 	skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
 				     ssid, ssid_len,
 				     buf, buf_len);
+	if (!skb)
+		goto out;
 
 	if (dst) {
 		mgmt = (struct ieee80211_mgmt *) skb->data;
@@ -888,6 +890,8 @@ struct sk_buff *ieee80211_build_probe_re
 	}
 
 	IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
+
+ out:
 	kfree(buf);
 
 	return skb;