Re: [PATCH] wifi: mac80211: avoid non-S1G AID fallback for S1G assoc

From: Lachlan Hodges

Date: Fri Jun 12 2026 - 10:09:25 EST


On Fri, Jun 12, 2026 at 09:36:50PM +0800, Zhao Li wrote:
> When assoc_data->s1g is set and no AID Response element is present,
> falling back to mgmt->u.assoc_resp.aid reads the non-S1G
> association-response layout.
>
> Keep the fallback for non-S1G only. If a successful S1G association
> response omits the AID Response element, abandon the association
> instead of proceeding with AID 0.

It might be nicer to explcitly state that AIDs distributed by an S1G
AP are done via the AID Response Element as opposed to the
(re)assoc response frame fixed field, so if you have an S1G
assoc response with no AID response it is invalid (In addition to
reading from the non-S1G field etc.).

> if (elems->aid_resp)
> aid = le16_to_cpu(elems->aid_resp->aid);
> - else
> + else if (!assoc_data->s1g)
> aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
> + else if (status_code == WLAN_STATUS_SUCCESS)
> + goto abandon_assoc;
> + else
> + aid = 0;

Those last two branches seem a bit weird, the only way to get there
is if you don't have an AID response element with an S1G connection
which is invalid regardless of what the AP status is so I think you
can just have something like:

if (elems->aid_resp)
aid = le16_to_cpu(elems->aid_resp->aid);
else if (!assoc_data->s1g)
aid = le16_to_cpu(mgmt->u.assoc_resp.aid);
else
goto abandon_assoc;

?

lachlan