Re: [PATCH rtw-next v3 3/5] wifi: rtw88: do not drop stations when collecting them for an iteration
From: Luka Gejak
Date: Fri Nov 20 2026 - 08:11:02 EST
Hi Mehmet,
Thanks for taking care of the allocation failure. One comment below.
On November 17, 2026 6:10:01 PM GMT+01:00, Mehmet Fide
<mehmet.fide@xxxxxxxxx> wrote:
> static void rtw_collect_sta_iter(void *data, struct ieee80211_sta *sta)
> {
> struct rtw_iter_stas_data *iter_stas = data;
> - struct rtw_stas_entry *stas_entry;
> + struct rtw_sta_info *si = (struct rtw_sta_info *)sta->drv_priv;
>
> - stas_entry = kmalloc_obj(*stas_entry, GFP_ATOMIC);
> - if (!stas_entry)
> - return;
> -
> - stas_entry->sta = sta;
> - list_add_tail(&stas_entry->list, &iter_stas->list);
> + list_add_tail(&si->iter_list, &iter_stas->list);
> }
Does the driver mutex still pin a client that has already gone back
from ASSOC to AUTH? In AP mode mac80211 can do that when userspace
clears ASSOCIATED. drv_sta_state() calls rtw_ops_sta_remove() then, but
leaves sta->uploaded set, so the watchdog can still collect the client.
If userspace deletes that client after the collection drops RCU,
mac80211 can free it without calling rtw_ops_sta_remove() again. The
temporary list now has a node in the freed station. list_del_init()
can write to that node before the callback runs. The old code already
kept the station pointer too long, and this adds the list operations
on it.
Could we skip stations with no si->vif while collecting them? As far as
I can see, rtw_sta_remove() clears it under the same mutex.
Best regards,
Luka Gejak