]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: mac80211: fix channel switching code
authorJohannes Berg <johannes.berg@intel.com>
Fri, 21 Nov 2025 10:37:34 +0000 (11:37 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 24 Nov 2025 12:05:11 +0000 (13:05 +0100)
commitde3c5142349c6cd67fbd20afc5b3ae320df436b7
treed456394ffe0cd1dc90e108754a257aa3e48e0076
parent49a9feaf30f441755a52877863a8697a8c3138d0
wifi: mac80211: fix channel switching code

My prior commit here introduced a bug due to copy/paste,
it was iterating the links assigned to 'ctx->replace_ctx'
and I replaced it by iterating links assigned to 'ctx' by
accident, then modified it for the iteration later.

Fix it to iterate the users of the correct chanctx, i.e.
'ctx->replace_ctx'.

Ultimately, this issue led to a crash in a hwsim test
(multi_ap_wps_shared_apdev_csa) because it would actually
do the switch (rather than refuse here) and then later
have a double-free of the original chanctx, because it
was still in use by another interface yet freed as part
of the switching.

Fixes: a1dc648aa76d ("wifi: mac80211: remove chanctx to link back-references")
Link: https://patch.msgid.link/20251121113733.7710a58d45eb.Ie9ec010b52b1baed93dbe44f968c2119b6b5d98d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/chan.c