summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQasim Ijaz <qasdev00@gmail.com>2025-04-21 14:13:44 +0300
committerFelix Fietkau <nbd@nbd.name>2025-05-21 15:49:39 +0300
commita0bdd3d1b94d22dd9d255fd148eb9183ea0a822f (patch)
treebf9f7ef42dcac752552e6d23a9f168c1a240d7b6
parentcb423ddad0f6e6f55b1700422ab777b25597cc83 (diff)
downloadlinux-a0bdd3d1b94d22dd9d255fd148eb9183ea0a822f.tar.xz
wifi: mt76: mt7996: avoid null deref in mt7996_stop_phy()
In mt7996_stop_phy() the mt7996_phy structure is dereferenced before the null sanity check which could lead to a null deref. Fix by moving the dereference operation after the sanity check. Fixes: 69d54ce7491d ("wifi: mt76: mt7996: switch to single multi-radio wiphy") Signed-off-by: Qasim Ijaz <qasdev00@gmail.com> Link: https://patch.msgid.link/20250421111344.11484-1-qasdev00@gmail.com Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r--drivers/net/wireless/mediatek/mt76/mt7996/main.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 5ec4f9793286..8698c4345af0 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -68,11 +68,13 @@ static int mt7996_start(struct ieee80211_hw *hw)
static void mt7996_stop_phy(struct mt7996_phy *phy)
{
- struct mt7996_dev *dev = phy->dev;
+ struct mt7996_dev *dev;
if (!phy || !test_bit(MT76_STATE_RUNNING, &phy->mt76->state))
return;
+ dev = phy->dev;
+
cancel_delayed_work_sync(&phy->mt76->mac_work);
mutex_lock(&dev->mt76.mutex);