Skip to content
/ linux Public

Commit 5a86d4e

Browse files
nbd168gregkh
authored andcommitted
mac80211: fix crash in ieee80211_chan_bw_change for AP_VLAN stations
commit 672e522 upstream. ieee80211_chan_bw_change() iterates all stations and accesses link->reserved.oper via sta->sdata->link[link_id]. For stations on AP_VLAN interfaces (e.g. 4addr WDS clients), sta->sdata points to the VLAN sdata, whose link never participates in chanctx reservations. This leaves link->reserved.oper zero-initialized with chan == NULL, causing a NULL pointer dereference in __ieee80211_sta_cap_rx_bw() when accessing chandef->chan->band during CSA. Resolve the VLAN sdata to its parent AP sdata using get_bss_sdata() before accessing link data. Cc: stable@vger.kernel.org Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://patch.msgid.link/20260305170812.2904208-1-nbd@nbd.name [also change sta->sdata in ARRAY_SIZE even if it doesn't matter] Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0e35db2 commit 5a86d4e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/mac80211/chan.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,14 +441,16 @@ static void ieee80211_chan_bw_change(struct ieee80211_local *local,
441441
rcu_read_lock();
442442
list_for_each_entry_rcu(sta, &local->sta_list,
443443
list) {
444-
struct ieee80211_sub_if_data *sdata = sta->sdata;
444+
struct ieee80211_sub_if_data *sdata;
445445
enum ieee80211_sta_rx_bandwidth new_sta_bw;
446446
unsigned int link_id;
447447

448448
if (!ieee80211_sdata_running(sta->sdata))
449449
continue;
450450

451-
for (link_id = 0; link_id < ARRAY_SIZE(sta->sdata->link); link_id++) {
451+
sdata = get_bss_sdata(sta->sdata);
452+
453+
for (link_id = 0; link_id < ARRAY_SIZE(sdata->link); link_id++) {
452454
struct ieee80211_link_data *link =
453455
rcu_dereference(sdata->link[link_id]);
454456
struct ieee80211_bss_conf *link_conf;

0 commit comments

Comments
 (0)