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>,
Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
Ville Nummela <ville.nummela@kempower.com>,
Marek Vasut <marex@nabladev.com>,
Rong Yan <rong.yan@mediatek.com>,
Deren Wu <deren.wu@mediatek.com>,
Hao Zhang <hao.zhang@mediatek.com>,
Nelson Yu <nelson.yu@mediatek.com>,
Prameela Rani Garnepudi <prameela.j04cs@gmail.com>,
Amitkumar Karwar <amit.karwar@redpinesignals.com>,
Kalle Valo <kvalo@kernel.org>,
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 2/4] wifi: mt76: mt7925: unwind link BSS add failures
Date: Thu, 24 Sep 2026 21:19:02 +0800 [thread overview]
Message-ID: <20260924131908.950229-3-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.
mt7925_mac_link_bss_add() reserves vif and OMAC bits and publishes the
station WCID before asking the firmware to add the device. If that command
fails, the function currently returns with those resources still installed.
The WCID pointer then refers into vif private data that mac80211 can free,
and the mask bits remain permanently allocated.
Use the existing link BSS removal helper to undo the published WCID, mask
bits, and WCID resources when the firmware add command fails.
Commit 2fb6480c52f6 ("wifi: mt76: mt7915: unwind state on add_interface
failure") fixed the same failure-unwind issue in mt7915.
Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/mediatek/mt76/mt7925/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 5993b31e1aae..25ad3bbdcd2c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -439,8 +439,10 @@ static int mt7925_mac_link_bss_add(struct mt792x_dev *dev,
ret = mt76_connac_mcu_uni_add_dev(&dev->mphy, link_conf, &mconf->mt76,
&mlink->wcid, true);
- if (ret)
+ if (ret) {
+ mt792x_mac_link_bss_remove(dev, mconf, mlink);
goto out;
+ }
if (vif->txq) {
mtxq = (struct mt76_txq *)vif->txq->drv_priv;
--
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 add_interface failures Jiale Yao
2026-09-24 13:19 ` [PATCH 1/4] wifi: mt76: mt7615: unwind " Jiale Yao
2026-09-24 13:19 ` Jiale Yao [this message]
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-3-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=Eason.Lai@mediatek.com \
--cc=amit.karwar@redpinesignals.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=deren.wu@mediatek.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=nelson.yu@mediatek.com \
--cc=prameela.j04cs@gmail.com \
--cc=rong.yan@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®