Re: [PATCH 3/3] wifi: cfg80211: check if AP has been started before adding new station

From: Slawomir Stepien

Date: Tue Sep 08 2026 - 08:08:42 EST


On wrz 08, 2026 11:46, Johannes Berg wrote:
> On Tue, 2026-09-08 at 11:44 +0200, Slawomir Stepien wrote:
> > On wrz 04, 2026 11:25, Johannes Berg wrote:
> > > On Thu, 2026-08-13 at 11:04 +0200, Slawomir Stepien wrote:
> > > >
> > > > case NL80211_IFTYPE_P2P_GO:
> > > > + /* Add a new station only after the AP and link has been started */
> > > > + link_id = wdev->valid_links ? params.link_sta_params.link_id : 0;
> > >
> > > max() maybe?
> > >
> > > > + if (!wdev->links[link_id].ap.beacon_interval)
> > > > + return -ENETDOWN;
> > >
> > > I think the same issue might exist also for mesh, maybe address that as
> > > well?
> > >
> > > And I think you could have a fourth patch to clean up the mac80211 code
> > > to no longer handle the "STA creation on AP_VLAN" case?
> >
> > But is there such case?
> > The only part I think is related is the handling code when params.vlan is set. However, this code is
> > still OK. I do not see any other code that would be a good candidate for removal/change.
> >
> > Am I missing something here?
>
> Don't think you're missing anything, there's just the block handling
> param->vlan in add_station, it's dead code now. But why not kill it?

For the reason explained below (in my previous message).
There can still be a command from userspace with AP base interface (as wdev) with
attrs[NL80211_ATTR_STA_VLAN] set and this block will be executed in such case. Right?

> > Also, during this check, I've came to a conclusion that I will reword a bit the commit message for
> > PATCH 1/3, since userspace can still add STA to AP_VLAN in one go, using
> > attrs[NL80211_ATTR_STA_VLAN] and that's fine, since the wdev would be the base AP interface, so all
> > check will happen.
>
> Sure :)

--
Slawomir Stepien