From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Felix Fietkau <nbd@nbd.name>, Ryder Lee <ryder.lee@mediatek.com>,
Shayne Chen <shayne.chen@mediatek.com>,
Sean Wang <sean.wang@mediatek.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Bo Jiao <Bo.Jiao@mediatek.com>,
Peter Chiu <chui-hao.chiu@mediatek.com>
Cc: linux-wireless@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Lorenzo Bianconi <lorenzo@kernel.org>
Subject: [PATCH mt76 1/4] wifi: mt76: mt7996: grab mt76 mutex in mt7996_mac_sta_event()
Date: Fri, 14 Nov 2025 14:16:21 +0100 [thread overview]
Message-ID: <20251114-mt76-fix-missing-mtx-v1-1-259ebf11f654@kernel.org> (raw)
In-Reply-To: <20251114-mt76-fix-missing-mtx-v1-0-259ebf11f654@kernel.org>
Grab mt76 mutex in mt7996_mac_sta_event routine in order to rely on
mt76_dereference() utility macro.
Fixes: ecd72f9695e7e ("wifi: mt76: mt7996: Support MLO in mt7996_mac_sta_event()")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 581314368c5ba566f6050bee86696c4654619176..ad8698cf16242489b92e23befab4d040abbdcac2 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1160,12 +1160,15 @@ mt7996_mac_sta_event(struct mt7996_dev *dev, struct ieee80211_vif *vif,
unsigned long links = sta->valid_links;
struct ieee80211_link_sta *link_sta;
unsigned int link_id;
+ int err = 0;
+
+ mutex_lock(&dev->mt76.mutex);
for_each_sta_active_link(vif, sta, link_sta, link_id) {
struct ieee80211_bss_conf *link_conf;
struct mt7996_sta_link *msta_link;
struct mt7996_vif_link *link;
- int i, err;
+ int i;
link_conf = link_conf_dereference_protected(vif, link_id);
if (!link_conf)
@@ -1185,12 +1188,12 @@ mt7996_mac_sta_event(struct mt7996_dev *dev, struct ieee80211_vif *vif,
link, msta_link,
CONN_STATE_CONNECT, true);
if (err)
- return err;
+ goto unlock;
err = mt7996_mcu_add_rate_ctrl(dev, msta_link->sta, vif,
link_id, false);
if (err)
- return err;
+ goto unlock;
msta_link->wcid.tx_info |= MT_WCID_TX_INFO_SET;
break;
@@ -1199,7 +1202,7 @@ mt7996_mac_sta_event(struct mt7996_dev *dev, struct ieee80211_vif *vif,
link, msta_link,
CONN_STATE_PORT_SECURE, false);
if (err)
- return err;
+ goto unlock;
break;
case MT76_STA_EVENT_DISASSOC:
for (i = 0; i < ARRAY_SIZE(msta_link->twt.flow); i++)
@@ -1219,8 +1222,10 @@ mt7996_mac_sta_event(struct mt7996_dev *dev, struct ieee80211_vif *vif,
break;
}
}
+unlock:
+ mutex_unlock(&dev->mt76.mutex);
- return 0;
+ return err;
}
static void
--
2.51.1
next prev parent reply other threads:[~2025-11-14 13:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-14 13:16 [PATCH mt76 0/4] wifi: mt76: mt7996: Fix some locking issues for MLO Lorenzo Bianconi
2025-11-14 13:16 ` Lorenzo Bianconi [this message]
2025-11-14 13:16 ` [PATCH mt76 2/4] wifi: mt76: mt7996: Move mt7996_update_beacons inside mt76 mutex critical section Lorenzo Bianconi
2025-11-14 13:16 ` [PATCH mt76 3/4] wifi: mt76: Move mt76_abort_scan out of mt76_reset_device() Lorenzo Bianconi
2025-11-14 13:16 ` [PATCH mt76 4/4] wifi: mt76: mt7996: skip deflink accounting for offchannel links Lorenzo Bianconi
2025-11-14 15:22 ` [PATCH mt76 0/4] wifi: mt76: mt7996: Fix some locking issues for MLO Ben Greear
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251114-mt76-fix-missing-mtx-v1-1-259ebf11f654@kernel.org \
--to=lorenzo@kernel.org \
--cc=Bo.Jiao@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chui-hao.chiu@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=sean.wang@mediatek.com \
--cc=shayne.chen@mediatek.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).