[PATCH 3/4] wifi: mt76: mt7921: unwind interface restore failures
Jiale Yao
yaojiale02 at 163.com
Tue Oct 27 22:03:36 PDT 2026
The reset recovery callback ignores failures while restoring an interface
in firmware and continues issuing per-vif configuration commands. A failed
two-command device addition can leave partial firmware state, while the
following commands operate on an interface that was not restored.
Check the restore result, remove any partially created firmware state and
stop configuring that interface on failure.
Fixes: 0c1ce9884607 ("mt76: mt7921: add wifi reset support")
Cc: stable at vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02 at 163.com>
---
drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
index 6f5e31489e2d..0d19f2d7dd5e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/mac.c
@@ -628,13 +628,23 @@ mt7921_vif_connect_iter(void *priv, u8 *mac,
struct mt792x_vif *mvif = (struct mt792x_vif *)vif->drv_priv;
struct mt792x_dev *dev = mvif->phy->dev;
struct ieee80211_hw *hw = mt76_hw(dev);
+ int ret;
if (vif->type == NL80211_IFTYPE_STATION)
ieee80211_disconnect(vif, true);
- mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
- &mvif->bss_conf.mt76,
- &mvif->sta.deflink.wcid, true);
+ ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+ &mvif->bss_conf.mt76,
+ &mvif->sta.deflink.wcid, true);
+ if (ret) {
+ mt76_connac_mcu_uni_add_dev(&dev->mphy, &vif->bss_conf,
+ &mvif->bss_conf.mt76,
+ &mvif->sta.deflink.wcid, false);
+ dev_err(dev->mt76.dev,
+ "failed to restore interface after reset: %d\n", ret);
+ return;
+ }
+
mt7921_mcu_set_tx(dev, vif);
if (vif->type == NL80211_IFTYPE_AP) {
--
2.34.1
More information about the Linux-mediatek
mailing list