From: Christian Lamparter <chunkeey@gmail.com>
To: Jiale Yao <yaojiale02@163.com>,
linux-wireless@vger.kernel.org,
Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH] wifi: p54: unwind failed interface additions
Date: Wed, 21 Oct 2026 22:32:48 +0200 [thread overview]
Message-ID: <6f37c00a-b949-4134-88cd-bf713f58d628@gmail.com> (raw)
In-Reply-To: <20261019013105.1487978-1-yaojiale02@163.com>
On 10/19/26 3:31 AM, Jiale Yao wrote:
> 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.
hmm?
<https://docs.kernel.org/driver-api/80211/mac80211.html>
|stop
| Called after last netdevice attached to the hardware is disabled.
| This should turn off the hardware (at least it must turn off frame reception.)
| >>> May be called right after add_interface if that rejects an interface <<<
so mac80211 should call drv_stop (aka. p54_stop) in ieee80211_do_open() if
p54_add_interface returns with an error code...
and p54_stop does:
priv->mode = NL80211_IFTYPE_UNSPECIFIED;
> 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>
priv->vif and priv->mac_addr remains set. I don't think that having priv->mac_addr
set matters. About priv->vif... Hmm, mac80211 passes it as &sdata->vif. So for the
lifetime of the associated mac80211 device this will always be the same?
(... as p54 only ever has one?)
So, even if beacon_loss traps are injected after a p54_add_interface fails, priv->vif
will be a valid pointer... didn't remember or see any other users...
hmm, it should be the same, but I don't know the mac80211 code well enough.
That said. I don't have a problem with the code. It reduces the "need to know
about mac80211 internals too" load... with that I'm struggeling too.
If you want to respin a v2 with the commit changes, you can have a:
Acked-by: Christian Lamparter <chunkeey@gmail.com>
And if not, I guess it's still fine (but not necessarily 100% correct maybe) as
is either way.
> ---
> 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;
> }
prev parent reply other threads:[~2026-10-21 20:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 1:31 [PATCH] wifi: p54: unwind failed interface additions Jiale Yao
2026-10-21 20:32 ` Christian Lamparter [this message]
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=6f37c00a-b949-4134-88cd-bf713f58d628@gmail.com \
--to=chunkeey@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=yaojiale02@163.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.