Re: [PATCH] Fix: Ensure auth_data and ap_addr are properly set before marking STA as authenticated

From: Johannes Berg
Date: Fri Nov 08 2024 - 02:45:37 EST


On Fri, 2024-11-08 at 07:58 +0530, Saru2003 wrote:
>
> +++ b/net/mac80211/mlme.c
> @@ -4247,8 +4247,15 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
> static bool ieee80211_mark_sta_auth(struct ieee80211_sub_if_data *sdata)
> {
> struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
> - const u8 *ap_addr = ifmgd->auth_data->ap_addr;
> + const u8 *ap_addr;
> struct sta_info *sta;
> +
> + if (!ifmgd->auth_data ||

That's ridiculous. By the argument behind this we could add probably
hundreds of such checks all over the place.

> !ifmgd->auth_data->ap_addr) {

and that's even a compiler warning.

> sta = sta_info_get(sdata, ap_addr);
> if (!sta) {
> - WARN_ONCE(1, "%s: STA %pM not found", sdata->name, ap_addr);
> + sdata_info(sdata, "STA %pM not found, skipping authentication mark\n", ap_addr);
> return false;

That's also wrong, it doesn't just skip that part.

johannes