wifi: mt76: check chanctx before restoring channel after ROC

mt76_remove_chanctx() sets phy->chanctx to NULL but does not clear
phy->main_chandef. If ROC is later performed on that phy, completion
tries to restore the stale main_chandef channel, programming the
hardware to sit on a channel with no active context.

Add a chanctx check to avoid restoring a channel when no context is
active.

Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2026-03-07 13:51:32 +00:00
parent b7d6e43438
commit 35e79a5bb1
+1 -1
View File
@@ -324,7 +324,7 @@ void mt76_roc_complete(struct mt76_phy *phy)
if (mlink) if (mlink)
mlink->mvif->roc_phy = NULL; mlink->mvif->roc_phy = NULL;
if (phy->main_chandef.chan && phy->offchannel && if (phy->chanctx && phy->main_chandef.chan && phy->offchannel &&
!test_bit(MT76_MCU_RESET, &dev->phy.state)) !test_bit(MT76_MCU_RESET, &dev->phy.state))
__mt76_set_channel(phy, &phy->main_chandef, false); __mt76_set_channel(phy, &phy->main_chandef, false);
mt76_put_vif_phy_link(phy, phy->roc_vif, phy->roc_link); mt76_put_vif_phy_link(phy, phy->roc_vif, phy->roc_link);