Skip to contentSkip to conversation

mac80211: fix possible NULL pointerderef in obss pd code

PATCH New John Crispin 1 participant 1 message Aug 13, 2019 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix possible NULL pointerderef in obss pd code

he_spr_ie_elem is dereferenced before the NULL check. fix this by moving the assignment after the check.

fixes commit 697f6c507c74 ("mac80211: propagate HE operation info into bss_conf")

This was reported by the static code checker.

---
 net/mac80211/he.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/he.c +2 -1
index a02abfc424aa..736da0035135 100644
@@ -72,12 +72,13 @@ ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
 {
 	struct ieee80211_he_obss_pd *he_obss_pd =
 					&vif->bss_conf.he_obss_pd;
-	const u8 *data = he_spr_ie_elem->optional;
+	const u8 *data;
 
 	memset(he_obss_pd, 0, sizeof(*he_obss_pd));
 
 	if (!he_spr_ie_elem)
 		return;
+	data = he_spr_ie_elem->optional;
 
 	if (he_spr_ie_elem->he_sr_control &
 	    IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
Signature · 1 line
2.20.1