[PATCH wireless v2 4/4] wifi: nxpwifi: stop AP when delayed channel switch fails

From: Zhao Li

Date: Wed Nov 18 2026 - 13:36:17 EST


The delayed channel-switch work can fail while stopping the BSS, setting
the beacon or restarting the AP. It then returns without telling
cfg80211, and TX stays enabled over the stopped BSS unless the request
set block_tx.

On each failure, stop the carrier and TX queues, clear uap_stop_tx and
request interface shutdown, then free the beacon update as on success.

Found by code review. Compile-tested with W=1.

Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Zhao Li <enderaoelyther@xxxxxxxxx>
---
No new W=1, sparse or smatch warnings.

AI assistance was used.

drivers/net/wireless/nxp/nxpwifi/11h.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/nxp/nxpwifi/11h.c b/drivers/net/wireless/nxp/nxpwifi/11h.c
index a6c87dfad9ee..d83f36b1c8a5 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,6 +337,13 @@ void nxpwifi_dfs_chan_sw_work(struct wiphy *wiphy, struct wiphy_work *work)
priv->uap_stop_tx = false;
}

+ goto out;
+
+stop_iface:
+ netif_carrier_off(priv->netdev);
+ nxpwifi_stop_net_dev_queue(priv->netdev, adapter);
+ priv->uap_stop_tx = false;
+ cfg80211_stop_iface(wiphy, &priv->wdev, GFP_KERNEL);
out:
kfree(priv->ap_update_info);
priv->ap_update_info = NULL;
--
2.56.1