From: Jiale Yao <yaojiale02@163.com>
To: "John W. Linville" <linville@tuxdriver.com>,
Daniel Drake <dsd@gentoo.org>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH] wifi: zd1211rw: unwind failed interface additions
Date: Mon, 19 Oct 2026 09:32:11 +0800 [thread overview]
Message-ID: <20261019013211.1489233-1-yaojiale02@163.com> (raw)
zd1211rw stores the vif and interface type before programming the MAC
and receive configuration. If that setup fails, mac80211 does not call
remove_interface and the stale type prevents another interface from
being added.
Clear the vif and type and restore the hardware MAC state before
returning the setup error.
Fixes: 459c51ad6e1f ("zd1211rw: port to mac80211")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/net/wireless/zydas/zd1211rw/zd_mac.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
index 03948f0b4628..abbe25623b44 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_mac.c
@@ -1102,6 +1102,7 @@ static int zd_op_add_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif)
{
struct zd_mac *mac = zd_hw_mac(hw);
+ int ret;
/* using NL80211_IFTYPE_UNSPECIFIED to indicate no mode selected */
if (mac->type != NL80211_IFTYPE_UNSPECIFIED)
@@ -1120,8 +1121,14 @@ static int zd_op_add_interface(struct ieee80211_hw *hw,
}
mac->vif = vif;
+ ret = set_mac_and_bssid(mac);
+ if (ret) {
+ mac->type = NL80211_IFTYPE_UNSPECIFIED;
+ mac->vif = NULL;
+ zd_write_mac_addr(&mac->chip, NULL);
+ }
- return set_mac_and_bssid(mac);
+ return ret;
}
static void zd_op_remove_interface(struct ieee80211_hw *hw,
--
2.34.1
next reply other threads:[~2026-10-19 1:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 1:32 Jiale Yao [this message]
2026-10-21 10:14 ` Johannes Berg
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=20261019013211.1489233-1-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=dsd@gentoo.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.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®