]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: mt7925: resolve link after acquiring mt76 mutex
authorSean Wang <sean.wang@mediatek.com>
Fri, 6 Mar 2026 23:22:30 +0000 (17:22 -0600)
committerFelix Fietkau <nbd@nbd.name>
Tue, 24 Mar 2026 15:49:32 +0000 (15:49 +0000)
mt792x_sta_to_link() uses rcu_dereference_protected() and therefore
expects mt76.mutex to be held. Move the lookup after
mt792x_mutex_acquire() to make the locking explicit and correct.

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

index 68f168a093f279f81b108f2210a63445d167435f..135a803b4382edd66cb5c9b23d50c869e1fd2591 100644 (file)
@@ -1071,11 +1071,11 @@ static void mt7925_mac_link_sta_assoc(struct mt76_dev *mdev,
        struct mt792x_link_sta *mlink;
        struct mt792x_sta *msta;
 
+       mt792x_mutex_acquire(dev);
+
        msta = (struct mt792x_sta *)link_sta->sta->drv_priv;
        mlink = mt792x_sta_to_link(msta, link_sta->link_id);
 
-       mt792x_mutex_acquire(dev);
-
        if (ieee80211_vif_is_mld(vif)) {
                link_conf = mt792x_vif_to_bss_conf(vif, msta->deflink_id);
        } else {