From: Zhao Li <enderaoelyther@gmail.com>
To: Jeff Chen <jeff.chen_1@nxp.com>
Cc: Francesco Dolcini <francesco@dolcini.it>,
Johannes Berg <johannes@sipsolutions.net>,
Arend van Spriel <arend.vanspriel@broadcom.com>,
Jiangshan Yi <yijiangshan@kylinos.cn>,
Linmao Li <lilinmao@kylinos.cn>,
Kees Cook <kees+treewide@kernel.org>,
Rosen Penev <rosenp@gmail.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
stable+noautosel@kernel.org
Subject: [PATCH 4/4] wifi: nxpwifi: stop AP when delayed channel switch fails
Date: Wed, 28 Oct 2026 22:18:19 +0800 [thread overview]
Message-ID: <20261028141819.7556-5-enderaoelyther@gmail.com> (raw)
In-Reply-To: <20261028141819.7556-1-enderaoelyther@gmail.com>
A delayed AP channel switch can fail while stopping the BSS, programming
the new beacon, or restarting the AP. The worker returns without notifying
cfg80211, and traffic can remain enabled over a stopped BSS when the
request did not set block_tx.
An earlier stop failure can also clear the driver's AP configuration while
cfg80211 still considers the AP running. A following channel switch then
reaches the worker without a beacon period and is discarded.
Disable carrier and the TX queues, retain the channel-switch state, and
request interface shutdown on all four failures. Keeping the state until
the stop path cancels it prevents another switch from starting while
shutdown is pending.
LLM assistance was used to find the bug and review.
Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x")
Cc: <stable+noautosel@kernel.org> # depends on the beacon ownership backport
Signed-off-by: Zhao Li <enderaoelyther@gmail.com>
---
Validation: A W=1 module build with MODPOST passed. Not
reproduced; IW61x hardware was unavailable.
Sparse C=2 passed. Targeted Smatch introduced no new diagnostics.
All four patches apply without changes to v7.3.
Stable pickup is disabled because this patch depends on that backport.
Persistent firmware-command failure recovery was not exercised. The patch
disables TX and requests interface shutdown; it does not prove that cfg80211
and firmware state converge if stop_ap() also fails.
drivers/net/wireless/nxp/nxpwifi/11h.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/net/wireless/nxp/nxpwifi/11h.c b/drivers/net/wireless/nxp/nxpwifi/11h.c
index a6c87dfad9ee..1341c9015ea4 100644
--- a/drivers/net/wireless/nxp/nxpwifi/11h.c
+++ b/drivers/net/wireless/nxp/nxpwifi/11h.c
@@ -300,22 +300,22 @@ void nxpwifi_dfs_chan_sw_work(struct wiphy *wiphy, struct wiphy_work *work)
bss_cfg = &priv->bss_cfg;
if (!bss_cfg->beacon_period) {
nxpwifi_dbg(adapter, ERROR,
- "channel switch: AP already stopped\n");
- goto out;
+ "channel switch: AP configuration is missing\n");
+ goto stop_iface;
}
if (nxpwifi_send_cmd(priv, HOST_CMD_UAP_BSS_STOP,
HOST_ACT_GEN_SET, 0, NULL, true)) {
nxpwifi_dbg(adapter, ERROR,
"channel switch: Failed to stop the BSS\n");
- goto out;
+ goto stop_iface;
}
if (nxpwifi_cfg80211_change_beacon(adapter->wiphy, priv->netdev,
priv->ap_update_info)) {
nxpwifi_dbg(adapter, ERROR,
"channel switch: Failed to set beacon\n");
- goto out;
+ goto stop_iface;
}
nxpwifi_uap_set_channel(priv, bss_cfg, priv->dfs_chandef);
@@ -323,7 +323,7 @@ void nxpwifi_dfs_chan_sw_work(struct wiphy *wiphy, struct wiphy_work *work)
if (nxpwifi_config_start_uap(priv, bss_cfg)) {
nxpwifi_dbg(adapter, ERROR,
"Failed to start AP after channel switch\n");
- goto out;
+ goto stop_iface;
}
nxpwifi_dbg(adapter, MSG,
@@ -337,7 +337,13 @@ void nxpwifi_dfs_chan_sw_work(struct wiphy *wiphy, struct wiphy_work *work)
priv->uap_stop_tx = false;
}
-out:
kfree(priv->ap_update_info);
priv->ap_update_info = NULL;
+ return;
+
+stop_iface:
+ netif_carrier_off(priv->netdev);
+ nxpwifi_stop_net_dev_queue(priv->netdev, adapter);
+ priv->uap_stop_tx = true;
+ cfg80211_stop_iface(wiphy, &priv->wdev, GFP_KERNEL);
}
--
2.56.0
prev parent reply other threads:[~2026-10-28 14:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 14:18 [PATCH 0/4] wifi: nxpwifi: fix AP channel-switch lifetime and failures Zhao Li
2026-10-28 14:18 ` [PATCH 1/4] wifi: nxpwifi: cancel channel switch work on teardown Zhao Li
2026-10-28 14:18 ` [PATCH 2/4] wifi: nxpwifi: stop AP TX after preparing channel switch Zhao Li
2026-10-28 14:18 ` [PATCH 3/4] wifi: nxpwifi: own beacon data used by channel switch work Zhao Li
2026-10-28 14:18 ` Zhao Li [this message]
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=20261028141819.7556-5-enderaoelyther@gmail.com \
--to=enderaoelyther@gmail.com \
--cc=arend.vanspriel@broadcom.com \
--cc=francesco@dolcini.it \
--cc=jeff.chen_1@nxp.com \
--cc=johannes@sipsolutions.net \
--cc=kees+treewide@kernel.org \
--cc=lilinmao@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=stable+noautosel@kernel.org \
--cc=yijiangshan@kylinos.cn \
/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