Skip to contentSkip to conversation

mac80211: fix NULL pointer dereference in monitor mode

PATCH In review Dhyan K Prajapati 2 participants 2 messages Feb 5 – Feb 6

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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

Crash trace:

  RIP: iwlagn_bss_info_changed+0x19d/0x640 [iwldvm]
  Code: 49 8b 46 10 <8b> 10
  RAX: 0000000000000000 (NULL link->conf->bss)

wifi: mac80211: fix NULL pointer deref regression in link notify Commit c57e5b974514 ("wifi: mac80211: fix WARN_ON for monitor mode on some devices") reorganized link change notifications. This caused a regression for hardware using IEEE80211_HW_WANT_MONITOR_VIF. In monitor mode, link->conf->bss is uninitialized, but current logic allows these notifications to reach driver callbacks, causing a deterministic NULL dereference in drivers like iwldvm. Fix this by validating the BSS context before driver notification.
Device: Intel Centrino Advanced-n 6205

Fixes c57e5b974514 ("wifi: mac80211: fix WARN_ON for monitor mode on some devices")
Cc Johannes Berg <[email protected]>
---
 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