Skip to contentSkip to conversation

mac80211: fix NULL ptr dereference during mesh peer connection for non HE devices

PATCH Superseded Abinaya Kalaiselvan 3 participants 4 messages Apr 15, 2021 – Jun 23, 2021 mac80211

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mac80211: fix NULL ptr dereference during mesh peer connection for non HE devices

"sband->iftype_data" is not assigned with any value for non HE supported devices, which causes NULL pointer access during mesh peer connection in those devices. Fix this by accessing the pointer after HE capabilities condition check.

Fixes 7f7aa94bcaf0 (mac80211: reduce peer HE MCS/NSS to own capabilities)

---
v2:
* ieee80211_sta_he_cap structure instance is initialized.

 net/mac80211/he.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/mac80211/he.c +3 -1
index 0c0b970..96a47b0 100644
@@ -111,7 +111,7 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
 				  struct sta_info *sta)
 {
 	struct ieee80211_sta_he_cap *he_cap = &sta->sta.he_cap;
-	struct ieee80211_sta_he_cap own_he_cap = sband->iftype_data->he_cap;
+	struct ieee80211_sta_he_cap own_he_cap = {0};
 	struct ieee80211_he_cap_elem *he_cap_ie_elem = (void *)he_cap_ie;
 	u8 he_ppe_size;
 	u8 mcs_nss_size;
@@ -123,6 +123,8 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
 	if (!he_cap_ie || !ieee80211_get_he_sta_cap(sband))
 		return;
 
+	 own_he_cap = sband->iftype_data->he_cap;
+
 	/* Make sure size is OK */
 	mcs_nss_size = ieee80211_he_mcs_nss_size(he_cap_ie_elem);
 	he_ppe_size =
Signature · 1 line
2.7.4
maintainer
#1 lore raw
Quoted 11 lines · Abinaya Kalaiselvan

"sband->iftype_data" is not assigned with any value for non HE supported devices, which causes NULL pointer access during mesh peer connection in those devices. Fix this by accessing the pointer after HE capabilities condition check.

Fixes 7f7aa94bcaf0 (mac80211: reduce peer HE MCS/NSS to own capabilities)

---
v2:
* ieee80211_sta_he_cap structure instance is initialized.

How about taking other feedback into account?

johannes

#2 lore raw
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Abinaya Kalaiselvan

"sband->iftype_data" is not assigned with any value for non HE supported devices, which causes NULL pointer access during mesh peer connection in those devices. Fix this by accessing the pointer after HE capabilities condition check.

Fixes 7f7aa94bcaf0 (mac80211: reduce peer HE MCS/NSS to own capabilities)

---
v2:
* ieee80211_sta_he_cap structure instance is initialized.

Quoted 4 lines

How about taking other feedback into account?

johannes

I got a crash because of this bug and this patch fixes it. Abinaya, do you plan to submit a version with the indentation fixed, or can I do it ?

#3 lore raw
Quoted 13 lines · Nicolas Cavallari
Quoted 12 lines · Johannes Berg
Quoted 11 lines · Abinaya Kalaiselvan

"sband->iftype_data" is not assigned with any value for non HE supported devices, which causes NULL pointer access during mesh peer connection in those devices. Fix this by accessing the pointer after HE capabilities condition check.

Fixes 7f7aa94bcaf0 (mac80211: reduce peer HE MCS/NSS to own capabilities)

---
v2:
* ieee80211_sta_he_cap structure instance is initialized.

Quoted 8 lines
Quoted 4 lines

How about taking other feedback into account?

johannes

I got a crash because of this bug and this patch fixes it. Abinaya, do you plan to submit a version with the indentation fixed, or can I do it ?

Thanks Nicolas. I have sent the updated patch with indentation fix.

Thanks,
Abinaya Kalaiselvan