public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: dhyaan19022009-hue <dhyan19022009@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dhyan K Prajapati <dhyaan19022009@gmail.com>
Subject: [PATCH v2] mac80211: fix NULL pointer dereference in monitor mode
Date: Thu,  5 Feb 2026 19:49:57 +0530	[thread overview]
Message-ID: <20260205141957.8527-1-dhyaan19022009@gmail.com> (raw)

From: Dhyan K Prajapati <dhyaan19022009@gmail.com>

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)
Signed-off-by: Dhyan K Prajapati <dhyaan19022009@gmail.com>
---
 net/mac80211/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b05e313c7..190222c26 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -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;
-- 
2.43.0


                 reply	other threads:[~2026-02-05 14:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260205141957.8527-1-dhyaan19022009@gmail.com \
    --to=dhyan19022009@gmail.com \
    --cc=dhyaan19022009@gmail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox