Skip to contentSkip to conversation

rsi: fix missing null pointer check from a failed ieee80211_probereq_get call

PATCH In review Colin King 2 participants 2 messages Feb 21, 2019 – Feb 28, 2019

Subsystems (4)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 rsi: fix missing null pointer check from a failed ieee80211_probereq_get call

From: Colin Ian King <[email protected]>

The call to ieee80211_probereq_get can return NULL if a skb allocation fails, so add a null pointer check and free an earlier skb on the error exit return path.

Fixes 7fdcb8e12660 ("rsi: add support for hardware scan offload")
---
 drivers/net/wireless/rsi/rsi_91x_mgmt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/wireless/rsi/rsi_91x_mgmt.c +4 -0
index 8c17842ac507..844f2fac298f 100644
@@ -1726,6 +1726,10 @@ int rsi_send_bgscan_probe_req(struct rsi_common *common,
 
 	probereq_skb = ieee80211_probereq_get(common->priv->hw, vif->addr, ssid,
 					      ssid_len, scan_req->ie_len);
+	if (!probereq_skb) {
+		dev_kfree_skb(skb);
+		return -ENOMEM;
+	}
 
 	memcpy(&skb->data[frame_len], probereq_skb->data, probereq_skb->len);
 
Signature · 1 line
2.20.1
#1 lore raw
Quoted 8 lines · Colin King

From: Colin Ian King <[email protected]>

The call to ieee80211_probereq_get can return NULL if a skb allocation fails, so add a null pointer check and free an earlier skb on the error exit return path.

Fixes 7fdcb8e12660 ("rsi: add support for hardware scan offload")

Patch applied to wireless-drivers-next.git, thanks.

74ee436f9581 rsi: fix missing null pointer check from a failed ieee80211_probereq_get call

Signature · 3 lines
https://patchwork.kernel.org/patch/10824023/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches