mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: orkunsari via B4 Relay <devnull+sariorkunemin.gmail.com@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>,
	 Benjamin Berg <benjamin.berg@intel.com>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	 orkunsari <sariorkunemin@gmail.com>
Subject: [PATCH wireless] wifi: mac80211: check for a NULL link in the MLD data RX station loop
Date: Wed, 04 Nov 2026 14:56:18 +0300	[thread overview]
Message-ID: <20261104-mac80211-mld-null-link-v1-1-4cc9a00bbbaa@gmail.com> (raw)

From: orkunsari <sariorkunemin@gmail.com>

Since commit 6d531b9af16e ("wifi: mac80211: rework RX packet
handling"), the loop over MLD link stations in
__ieee80211_rx_handle_packet() passes the result of
rcu_dereference(sdata->link[link_sta->link_id]) straight to
ieee80211_rx_valid_freq(), which dereferences link->sdata.

ieee80211_vif_update_links() clears sdata->link[] for a removed link
before ieee80211_sta_remove_link() and sta_info_flush() take the
corresponding link stations out of the hash table, so a frame received
from that link's address in between finds a link station whose link
pointer is NULL.  The management frame path already checks for this.

Skip link stations without a link, as the management path does.

This was found by AI-assisted code review (Claude Code).  The fix has
been build-tested with W=1 only; no reproducer was run.

Fixes: 6d531b9af16e ("wifi: mac80211: rework RX packet handling")
Signed-off-by: orkunsari <sariorkunemin@gmail.com>
---
Regression in v7.4-rc1 only; released kernels are not affected.
---
 net/mac80211/rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index ecee9348c7..038bca60a7 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -5469,7 +5469,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
 			sdata =	sta->sdata;
 			link = rcu_dereference(sdata->link[link_sta->link_id]);
 
-			if (!ieee80211_rx_valid_freq(status->freq, link))
+			if (!link || !ieee80211_rx_valid_freq(status->freq, link))
 				continue;
 
 			if (rx_data_pending) {

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261104-mac80211-mld-null-link-82fc4b8bfdf1

Best regards,
--  
orkunsari <sariorkunemin@gmail.com>



                 reply	other threads:[~2026-11-04 11:56 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=20261104-mac80211-mld-null-link-v1-1-4cc9a00bbbaa@gmail.com \
    --to=devnull+sariorkunemin.gmail.com@kernel.org \
    --cc=benjamin.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sariorkunemin@gmail.com \
    /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

all inboxes | Powered by JetHome®