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>,
Deren Wu <deren.wu@mediatek.com>,
Hao Zhang <hao.zhang@mediatek.com>,
Quan Zhou <quan.zhou@mediatek.com>,
Amitkumar Karwar <amit.karwar@redpinesignals.com>,
Kalle Valo <kvalo@kernel.org>,
Prameela Rani Garnepudi <prameela.j04cs@gmail.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 3/4] wifi: rsi: unwind add_interface failure
Date: Thu, 24 Sep 2026 21:19:03 +0800 [thread overview]
Message-ID: <20260924131908.950229-4-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.
rsi_mac80211_add_interface() stores the vif in adapter->vifs[] and
increments sc_nvifs before sending the VAP capabilities command. If that
command fails, the function returns without undoing either update. The
array entry can therefore refer to vif memory freed by mac80211, while the
interface count remains inflated.
Clear the vif slot and restore sc_nvifs when setting VAP capabilities
fails, mirroring the state cleanup in remove_interface().
Commit 2fb6480c52f6 ("wifi: mt76: mt7915: unwind state on add_interface
failure") fixed the same failure-unwind pattern in another wireless driver.
Fixes: b8bd3a439f35 ("rsi: add/remove interface enhancements for p2p")
Cc: stable@vger.kernel.org
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/rsi/rsi_91x_mac80211.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 3faf2235728b..34ddcbc43fdc 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -518,6 +518,8 @@ static int rsi_mac80211_add_interface(struct ieee80211_hw *hw,
if (rsi_set_vap_capabilities(common, intf_mode, vif->addr,
vif_info->vap_id, vap_status)) {
rsi_dbg(ERR_ZONE, "Failed to set VAP capabilities\n");
+ adapter->vifs[vap_idx] = NULL;
+ adapter->sc_nvifs--;
mutex_unlock(&common->mutex);
return -EINVAL;
}
--
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 ` [PATCH 2/4] wifi: mt76: mt7925: unwind link BSS add failures Jiale Yao
2026-09-24 13:19 ` Jiale Yao [this message]
2026-09-24 13:19 ` [PATCH 4/4] wifi: mm81x: unwind add_interface failure 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-4-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=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®