Skip to contentSkip to conversation

iwlwifi: dvm: fix NULL pointer dereference in rxon

PATCH In review dhyaan19022009-hue 2 participants 2 messages Feb 4 Intel wireless wifi link (iwlwifi)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iwlwifi: dvm: fix NULL pointer dereference in rxon

When bringing up the wireless interface via virtual monitor mode, iwlagn_bss_info_changed() can be called with a vif that has no associated rxon context. This occurs during the ieee80211_add_virtual_monitor() -> ieee80211_do_open() sequence.

The function iwl_rxon_ctx_from_vif() returns NULL for virtual monitor interfaces, causing a NULL pointer dereference when the code attempts to access ctx fields at offset +0x10.

Crash signature:

  BUG: kernel NULL pointer dereference, address: 0000000000000000
  RIP: 0010:iwlagn_bss_info_changed+0x19d/0x640 [iwldvm]
  Call Trace:
   drv_link_info_changed+0x2b5/0x2c0 [mac80211]
   ieee80211_link_info_change_notify+0x13d/0x160 [mac80211]
   ieee80211_recalc_txpower+0x5c/0x60 [mac80211]
   ieee80211_assign_link_chanctx+0x182/0x410 [mac80211]
   ieee80211_add_virtual_monitor+0x17c/0x2b0 [mac80211]
   ieee80211_do_open+0x6d8/0x740 [mac80211]

Add an early NULL check for ctx before accessing its members.

Hardware: Dell Latitude E6430
WiFi: Intel Centrino Advanced-N 6205 [8086:0085]
Kernel: 6.18.7-061807-generic

---
 drivers/net/wireless/intel/iwlwifi/dvm/rxon.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/wireless/intel/iwlwifi/dvm/rxon.c +5 -0
index e08e44cae..91dcf18b1 100644
@@ -1392,6 +1392,11 @@ void iwlagn_bss_info_changed(struct ieee80211_hw *hw,
 
 	mutex_lock(&priv->mutex);
 
+
+        if (!ctx) {
+		mutex_unlock(&priv->mutex);
+		return;
+	}
 	if (changes & BSS_CHANGED_IDLE && vif->cfg.idle) {
 		/*
 		 * If we go idle, then clearly no "passive-no-rx"
Signature · 1 line
2.43.0
#1 lore raw
Quoted 20 lines · On Wed, 2026-02-04 at 18:23 +0530, dhyaan19022009-hue wrote:

When bringing up the wireless interface via virtual monitor mode, iwlagn_bss_info_changed() can be called with a vif that has no associated rxon context. This occurs during the ieee80211_add_virtual_monitor() -> ieee80211_do_open() sequence.

The function iwl_rxon_ctx_from_vif() returns NULL for virtual monitor interfaces, causing a NULL pointer dereference when the code attempts to access ctx fields at offset +0x10.

Crash signature:

  BUG: kernel NULL pointer dereference, address: 0000000000000000
  RIP: 0010:iwlagn_bss_info_changed+0x19d/0x640 [iwldvm]
  Call Trace:
   drv_link_info_changed+0x2b5/0x2c0 [mac80211]
   ieee80211_link_info_change_notify+0x13d/0x160 [mac80211]
   ieee80211_recalc_txpower+0x5c/0x60 [mac80211]
   ieee80211_assign_link_chanctx+0x182/0x410 [mac80211]
   ieee80211_add_virtual_monitor+0x17c/0x2b0 [mac80211]
   ieee80211_do_open+0x6d8/0x740 [mac80211]
Quoted 7 lines

Add an early NULL check for ctx before accessing its members.

Hardware: Dell Latitude E6430
WiFi: Intel Centrino Advanced-N 6205 [8086:0085]
Kernel: 6.18.7-061807-generic

Yeah, no. Please find someone who's willing to teach you first.

johannes