developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 1 | From c8d653d2b80ec1d58e9efd947196ee9d0fbf871b Mon Sep 17 00:00:00 2001 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 2 | From: MeiChia Chiu <meichia.chiu@mediatek.com> |
| 3 | Date: Thu, 26 Oct 2023 10:08:10 +0800 |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 4 | Subject: [PATCH 015/116] mtk: wifi: mt76: mt7996: Fixed null pointer |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 5 | dereference issue |
| 6 | |
| 7 | Without this patch, when the station is still in Authentication stage and |
| 8 | sends a "Notify bandwidth change action frame" to AP at the same time, |
| 9 | there will be a race condition that causes a crash to occur because the AP |
| 10 | access "msta->vif" that has not been fully initialized. |
| 11 | |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 12 | Signed-off-by: Bo Jiao <Bo.Jiao@mediatek.com> |
| 13 | Signed-off-by: Money Wang <money.wang@mediatek.com> |
| 14 | Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com> |
| 15 | --- |
| 16 | mt7996/main.c | 7 +++++++ |
| 17 | 1 file changed, 7 insertions(+) |
| 18 | |
| 19 | diff --git a/mt7996/main.c b/mt7996/main.c |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 20 | index 0e8abe7..e66c607 100644 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 21 | --- a/mt7996/main.c |
| 22 | +++ b/mt7996/main.c |
| 23 | @@ -1079,9 +1079,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 | -- |
developer | 9237f44 | 2024-06-14 17:13:04 +0800 | [diff] [blame] | 41 | 2.18.0 |
developer | 66e89bc | 2024-04-23 14:50:01 +0800 | [diff] [blame] | 42 | |