Commit 5db16ba8 authored by John Crispin's avatar John Crispin Committed by Johannes Berg

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 697f6c50 ("mac80211: propagate HE operation info into
bss_conf")

This was reported by the static code checker.
Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJohn Crispin <john@phrozen.org>
Link: https://lore.kernel.org/r/20190813070712.25509-1-john@phrozen.orgSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 9cf02338
...@@ -72,12 +72,13 @@ ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif, ...@@ -72,12 +72,13 @@ ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
{ {
struct ieee80211_he_obss_pd *he_obss_pd = struct ieee80211_he_obss_pd *he_obss_pd =
&vif->bss_conf.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)); memset(he_obss_pd, 0, sizeof(*he_obss_pd));
if (!he_spr_ie_elem) if (!he_spr_ie_elem)
return; return;
data = he_spr_ie_elem->optional;
if (he_spr_ie_elem->he_sr_control & if (he_spr_ie_elem->he_sr_control &
IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT) IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment