From: Jiale Yao <yaojiale02@163.com>
To: Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Runyu Xiao <runyu.xiao@seu.edu.cn>,
Ming Yen Hsieh <mingyen.hsieh@mediatek.com>,
Javier Tia <floss@jetm.me>, Leon Yen <leon.yen@mediatek.com>,
Eason Lai <Eason.Lai@mediatek.com>,
Marek Vasut <marex@nabladev.com>,
Ville Nummela <ville.nummela@kempower.com>,
Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
Quan Zhou <quan.zhou@mediatek.com>,
Hao Zhang <hao.zhang@mediatek.com>, Kalle Valo <kvalo@kernel.org>,
Prameela Rani Garnepudi <prameela.j04cs@gmail.com>,
Amitkumar Karwar <amit.karwar@redpinesignals.com>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org
Cc: Jiale Yao <yaojiale02@163.com>, stable@vger.kernel.org
Subject: [PATCH 1/4] wifi: mt76: mt7615: unwind add_interface failures
Date: Thu, 24 Sep 2026 21:19:01 +0800 [thread overview]
Message-ID: <20260924131908.950229-2-yaojiale02@163.com> (raw)
In-Reply-To: <20260924131908.950229-1-yaojiale02@163.com>
mac80211 does not call remove_interface() after add_interface() fails, so
the driver must undo any state it published before returning an error.
mt7615_add_interface() records a monitor vif before resource allocation,
and later reserves vif and OMAC bits and publishes the station WCID. An
allocation or firmware failure leaves some or all of that state behind.
The stale monitor_vif can then be used by the testmode transmit path after
mac80211 frees the vif, while the leaked mask bits permanently consume
interface resources.
Unpublish the WCID and release its resources when adding device information
fails, clear the reserved mask bits after failures that occur after their
allocation, and clear monitor_vif on every failed add.
Commit 2fb6480c52f6 ("wifi: mt76: mt7915: unwind state on add_interface
failure") fixed the same failure-unwind issue in mt7915.
Fixes: 4f0bce1c8888 ("mt76: mt7615: implement testmode support")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
.../net/wireless/mediatek/mt76/mt7615/main.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 67f56e428d9a..d20b109666dc 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -219,7 +219,7 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
ret = mt7615_mcu_set_dbdc(dev);
if (ret)
- goto out;
+ goto err_mask;
idx = MT7615_WTBL_RESERVED - mvif->mt76.idx;
@@ -237,7 +237,24 @@ static int mt7615_add_interface(struct ieee80211_hw *hw,
}
ret = mt7615_mcu_add_dev_info(phy, vif, true);
+ if (ret)
+ goto err_wcid;
+
+ mt7615_mutex_release(dev);
+
+ return 0;
+
+err_wcid:
+ rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
+ mt76_wcid_cleanup(&dev->mt76, &mvif->sta.wcid);
+err_mask:
+ dev->mt76.vif_mask &= ~BIT_ULL(mvif->mt76.idx);
+ dev->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
+ phy->omac_mask &= ~BIT_ULL(mvif->mt76.omac_idx);
out:
+ if (phy->monitor_vif == vif)
+ phy->monitor_vif = NULL;
+
mt7615_mutex_release(dev);
return ret;
--
2.34.1
next prev parent reply other threads:[~2026-09-24 13:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 13:19 [PATCH 0/4] wifi: unwind state after " Jiale Yao
2026-09-24 13:19 ` Jiale Yao [this message]
2026-09-24 13:19 ` [PATCH 2/4] wifi: mt76: mt7925: unwind link BSS add failures Jiale Yao
2026-09-24 13:19 ` [PATCH 3/4] wifi: rsi: unwind add_interface failure Jiale Yao
2026-09-24 13:19 ` [PATCH 4/4] wifi: mm81x: " Jiale Yao
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=20260924131908.950229-2-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=Eason.Lai@mediatek.com \
--cc=amit.karwar@redpinesignals.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=floss@jetm.me \
--cc=hao.zhang@mediatek.com \
--cc=kvalo@kernel.org \
--cc=leon.yen@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=marex@nabladev.com \
--cc=matthias.bgg@gmail.com \
--cc=mingyen.hsieh@mediatek.com \
--cc=nbd@nbd.name \
--cc=prameela.j04cs@gmail.com \
--cc=quan.zhou@mediatek.com \
--cc=runyu.xiao@seu.edu.cn \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=sebastian.krzyszkowiak@puri.sm \
--cc=shayne.chen@mediatek.com \
--cc=stable@vger.kernel.org \
--cc=ville.nummela@kempower.com \
/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
all inboxes | Powered by JetHome®