blob: 25d942c4405e1e75aa8b3edd52a9921922157165 [file] [log] [blame]
developer43a264f2024-03-26 14:09:54 +08001From cd699c6764e92f89aef0c75fa0c5a5c69402bcf6 Mon Sep 17 00:00:00 2001
developerd243af02023-12-21 14:49:33 +08002From: MeiChia Chiu <meichia.chiu@mediatek.com>
3Date: Thu, 26 Oct 2023 10:08:10 +0800
developer43a264f2024-03-26 14:09:54 +08004Subject: [PATCH 13/17] mtk: wifi: mt76: mt7996: Fixed null pointer dereference
developerd243af02023-12-21 14:49:33 +08005 issue
6
7Without this patch, when the station is still in Authentication stage and
8sends a "Notify bandwidth change action frame" to AP at the same time,
9there will be a race condition that causes a crash to occur because the AP
10access "msta->vif" that has not been fully initialized.
11
12Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com>
13Signed-off-by: Money Wang <money.wang@mediatek.com>
14Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com>
15---
16 mt7996/main.c | 7 +++++++
17 1 file changed, 7 insertions(+)
18
19diff --git a/mt7996/main.c b/mt7996/main.c
developerebda9012024-02-22 13:42:45 +080020index 625f87b4..ad2c6a9d 100644
developerd243af02023-12-21 14:49:33 +080021--- a/mt7996/main.c
22+++ b/mt7996/main.c
23@@ -1063,9 +1063,16 @@ static void mt7996_sta_rc_update(struct ieee80211_hw *hw,
24 struct ieee80211_sta *sta,
25 u32 changed)
26 {
27+ struct mt7996_sta *msta = (struct mt7996_sta *)sta->drv_priv;
28 struct mt7996_phy *phy = mt7996_hw_phy(hw);
29 struct mt7996_dev *dev = phy->dev;
30
31+ if (!msta->vif) {
32+ dev_warn(dev->mt76.dev, "Un-initialized STA %pM wcid %d in rc_work\n",
33+ sta->addr, msta->wcid.idx);
34+ return;
35+ }
36+
37 mt7996_sta_rc_work(&changed, sta);
38 ieee80211_queue_work(hw, &dev->rc_work);
39 }
40--
412.18.0
42