Skip to contentSkip to conversation

mac80211: fix NULL pointer dereference in monitor mode

PATCH Superseded dhyaan19022009-hue 1 participant 1 message Feb 5 mac80211

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mac80211: fix NULL pointer dereference in monitor mode

From: Dhyan K Prajapati <[email protected]>

When switching an interface to monitor mode on drivers that set the IEEE80211_HW_WANT_MONITOR_VIF flag, ieee80211_link_info_change_notify() can pass BSS change notifications to the driver callback even though monitor interfaces have no associated BSS context (link->conf->bss is NULL) This triggers a NULL pointer dereference in drivers like iwldvm when they access BSS-specific fields without checking for NULL. Example crash on Intel Centrino Advanced-N 6205 (iwldvm):

  BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 5295.135825]

fixed the issue by adding a NULL check for link->conf->bss before proceeding to driver notification
Tested on Intel Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

---
 net/mac80211/main.c | 2 ++
 1 file changed, 2 insertions(+)
net/mac80211/main.c +2 -0
index b05e313c7..190222c26 100644
@@ -416,6 +416,8 @@ void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata,
 	case NL80211_IFTYPE_MONITOR:
 		if (!ieee80211_hw_check(&local->hw, WANT_MONITOR_VIF))
 			return;
+		if (!link->conf->bss)
+			return;
 		break;
 	default:
 		break;
Signature · 1 line
2.43.0