Stopping an AP while channel-switch work is pending leaves the delayed work armed, and the callback later runs on an AP that is gone, or on freed driver state after removal. Cancel the work when the AP stops, and clear uap_stop_tx, which a pending switch with block_tx has set. Interface deletion, type changes and driver removal all stop a running AP first. Found by code review. Compile-tested with W=1. Fixes: 73b01e57ed3e ("wifi: nxp: add nxpwifi driver for IW61x") Cc: stable@vger.kernel.org Signed-off-by: Zhao Li --- No new W=1, sparse or smatch warnings. AI assistance was used. drivers/net/wireless/nxp/nxpwifi/cfg80211.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c index ba54078b082c..5b8fb37c3f3d 100644 --- a/drivers/net/wireless/nxp/nxpwifi/cfg80211.c +++ b/drivers/net/wireless/nxp/nxpwifi/cfg80211.c @@ -1639,6 +1639,8 @@ static int nxpwifi_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, struct nxpwifi_private *priv = nxpwifi_netdev_get_priv(dev); int ret; + wiphy_delayed_work_cancel(wiphy, &priv->dfs_chan_sw_work); + priv->uap_stop_tx = false; nxpwifi_abort_cac(priv); if (nxpwifi_del_mgmt_ies(priv)) -- 2.56.1