blob: 81601e436829dc3d0a3c40da8aed4e9b5fdbfdcb [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 7b49a07b4440843e3a85c268d3526b410ebf061e Mon Sep 17 00:00:00 2001
developer70180b02023-11-14 17:01:47 +08002From: MeiChia Chiu <meichia.chiu@mediatek.com>
3Date: Thu, 26 Oct 2023 21:11:05 +0800
developera20cdc22024-05-31 18:57:31 +08004Subject: [PATCH 05/21] wifi: mt76: mt7915: Fixed null pointer dereference
developer70180b02023-11-14 17:01:47 +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 mt7915/main.c | 7 +++++++
17 1 file changed, 7 insertions(+)
18
19diff --git a/mt7915/main.c b/mt7915/main.c
developer05f3b2b2024-08-19 19:17:34 +080020index a2ad918d..ec2360c3 100644
developer70180b02023-11-14 17:01:47 +080021--- a/mt7915/main.c
22+++ b/mt7915/main.c
developera46f6132024-03-26 14:09:54 +080023@@ -1170,9 +1170,16 @@ static void mt7915_sta_rc_update(struct ieee80211_hw *hw,
developer70180b02023-11-14 17:01:47 +080024 struct ieee80211_sta *sta,
25 u32 changed)
26 {
27+ struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
28 struct mt7915_phy *phy = mt7915_hw_phy(hw);
29 struct mt7915_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 mt7915_sta_rc_work(&changed, sta);
38 ieee80211_queue_work(hw, &dev->rc_work);
39 }
40--
developer1a173672023-12-21 14:49:33 +0800412.18.0
developer70180b02023-11-14 17:01:47 +080042