]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7925: move WCID teardown into link_sta_remove()
authorSean Wang <sean.wang@mediatek.com>
Fri, 6 Mar 2026 23:22:35 +0000 (17:22 -0600)
committerFelix Fietkau <nbd@nbd.name>
Tue, 24 Mar 2026 15:49:32 +0000 (15:49 +0000)
Move WCID teardown into mt7925_mac_link_sta_remove() to mirror the
dev->mt76.wcid[] publish done during link add.

This clears the published WCID before the rest of teardown, so WCID
lookups no longer expose a link that is being removed.

No functional change intended.

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Link: https://patch.msgid.link/20260306232238.2039675-17-sean.wang@kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/mt7925/main.c

index d99dbd707fcdb2ad5423f34a946a1d600412d9d5..9e3f3874d0b3ea83c44a1c18f3862c16ae7ca41c 100644 (file)
@@ -1151,12 +1151,14 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
                                       struct mt792x_link_sta *mlink)
 {
        struct mt792x_dev *dev = container_of(mdev, struct mt792x_dev, mt76);
+       struct mt76_wcid *wcid = &mlink->wcid;
        struct ieee80211_bss_conf *link_conf;
        u8 link_id = link_sta->link_id;
+       u16 idx = wcid->idx;
 
        mt7925_roc_abort_sync(dev);
 
-       mt76_connac_free_pending_tx_skbs(&dev->pm, &mlink->wcid);
+       mt76_connac_free_pending_tx_skbs(&dev->pm, wcid);
        mt76_connac_pm_wake(&dev->mphy, &dev->pm);
 
        mt7925_mcu_sta_update(dev, link_sta, vif, mlink, false,
@@ -1183,6 +1185,10 @@ static void mt7925_mac_link_sta_remove(struct mt76_dev *mdev,
                list_del_init(&mlink->wcid.poll_list);
        spin_unlock_bh(&mdev->sta_poll_lock);
 
+       rcu_assign_pointer(dev->mt76.wcid[idx], NULL);
+       mt76_wcid_cleanup(mdev, wcid);
+       mt76_wcid_mask_clear(mdev->wcid_mask, idx);
+
        mt76_connac_power_save_sched(&dev->mphy, &dev->pm);
 }
 
@@ -1191,8 +1197,6 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
                            struct ieee80211_sta *sta, unsigned long old_links)
 {
        struct mt792x_sta *msta = (struct mt792x_sta *)sta->drv_priv;
-       struct mt76_dev *mdev = &dev->mt76;
-       struct mt76_wcid *wcid;
        unsigned int link_id;
 
        /* clean up bss before starec */
@@ -1235,16 +1239,12 @@ mt7925_mac_sta_remove_links(struct mt792x_dev *dev, struct ieee80211_vif *vif,
                if (!mlink)
                        continue;
 
-               mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta, mlink);
-
-               wcid = &mlink->wcid;
                rcu_assign_pointer(msta->link[link_id], NULL);
                msta->valid_links &= ~BIT(link_id);
                mlink->sta = NULL;
                mlink->pri_link = NULL;
 
-               mt76_wcid_cleanup(mdev, wcid);
-               mt76_wcid_mask_clear(mdev->wcid_mask, wcid->idx);
+               mt7925_mac_link_sta_remove(&dev->mt76, vif, link_sta, mlink);
 
                if (msta->deflink_id == link_id)
                        msta->deflink_id = IEEE80211_LINK_UNSPECIFIED;