On Nov 17, Felix Fietkau wrote: > mt7925_mac_sta_poll() tests its local copy of sta_poll_list and reads > the first entry without sta_poll_lock, while a link removal takes the > wcid off that list under the lock. If the removal takes the last link > between the two reads, the poll takes the list head for a link and > writes its airtime counters to the stack. > > Test the list and take the link off it in one locked section, as > mt7921_mac_sta_poll() does. > > Fixes: c948b5da6bbe ("wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips") > Signed-off-by: Felix Fietkau Reviewed-by: Lorenzo Bianconi > --- > drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c > index 5518960e1375..2528c2f5d717 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7925/mac.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7925/mac.c > @@ -54,12 +54,14 @@ static void mt7925_mac_sta_poll(struct mt792x_dev *dev) > u16 idx; > u8 bw; > > - if (list_empty(&sta_poll_list)) > + spin_lock_bh(&dev->mt76.sta_poll_lock); > + if (list_empty(&sta_poll_list)) { > + spin_unlock_bh(&dev->mt76.sta_poll_lock); > break; > + } > mlink = list_first_entry(&sta_poll_list, > struct mt792x_link_sta, wcid.poll_list); > msta = mlink->sta; > - spin_lock_bh(&dev->mt76.sta_poll_lock); > list_del_init(&mlink->wcid.poll_list); > spin_unlock_bh(&dev->mt76.sta_poll_lock); > > -- > 2.47.3 > >