Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: p54: unwind failed interface additions
@ 2026-10-19  1:31 Jiale Yao
  2026-10-21 20:32 ` Christian Lamparter
  0 siblings, 1 reply; 2+ messages in thread
From: Jiale Yao @ 2026-10-19  1:31 UTC (permalink / raw)
  To: Christian Lamparter, John W. Linville, linux-wireless,
	linux-kernel
  Cc: Jiale Yao

p54 stores the vif and changes its operating mode before validating the
interface type and before p54_setup_mac() can fail. Since mac80211 does
not call remove_interface after a failed add, either path can leave the
driver believing that an interface remains active.

Publish the vif only after type validation and restore the monitor state
when MAC setup fails.

Fixes: 1ed32e4fc8cf ("mac80211: remove struct ieee80211_if_init_conf")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
 drivers/net/wireless/intersil/p54/main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/intersil/p54/main.c b/drivers/net/wireless/intersil/p54/main.c
index 57a62108cbc3..69d85efb9260 100644
--- a/drivers/net/wireless/intersil/p54/main.c
+++ b/drivers/net/wireless/intersil/p54/main.c
@@ -236,8 +236,6 @@ static int p54_add_interface(struct ieee80211_hw *dev,
 		return -EOPNOTSUPP;
 	}
 
-	priv->vif = vif;
-
 	switch (vif->type) {
 	case NL80211_IFTYPE_STATION:
 	case NL80211_IFTYPE_ADHOC:
@@ -250,8 +248,14 @@ static int p54_add_interface(struct ieee80211_hw *dev,
 		return -EOPNOTSUPP;
 	}
 
+	priv->vif = vif;
 	memcpy(priv->mac_addr, vif->addr, ETH_ALEN);
 	err = p54_setup_mac(priv);
+	if (err) {
+		priv->vif = NULL;
+		priv->mode = NL80211_IFTYPE_MONITOR;
+		eth_zero_addr(priv->mac_addr);
+	}
 	mutex_unlock(&priv->conf_mutex);
 	return err;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-21 20:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-19  1:31 [PATCH] wifi: p54: unwind failed interface additions Jiale Yao
2026-10-21 20:32 ` Christian Lamparter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox