* [PATCH] wifi: mt76: mt7996: avoid null deref in mt7996_stop_phy()
@ 2025-03-22 11:13 Qasim Ijaz
2025-03-22 13:54 ` Markus Elfring
0 siblings, 1 reply; 2+ messages in thread
From: Qasim Ijaz @ 2025-03-22 11:13 UTC (permalink / raw)
To: nbd, lorenzo, ryder.lee, shayne.chen, sean.wang, matthias.bgg,
angelogioacchino.delregno, chui-hao.chiu, Bo.Jiao
Cc: linux-wireless, linux-kernel, linux-arm-kernel, linux-mediatek
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>
---
drivers/net/wireless/mediatek/mt76/mt7996/main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 66575698aef1..88e013577c0d 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);
--
2.39.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] wifi: mt76: mt7996: avoid null deref in mt7996_stop_phy()
2025-03-22 11:13 [PATCH] wifi: mt76: mt7996: avoid null deref in mt7996_stop_phy() Qasim Ijaz
@ 2025-03-22 13:54 ` Markus Elfring
0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2025-03-22 13:54 UTC (permalink / raw)
To: Qasim Ijaz, linux-wireless, linux-mediatek, linux-arm-kernel
Cc: LKML, Angelo Gioacchino Del Regno, Bo Jiao, Dan Carpenter,
Felix Fietkau, Johannes Berg, Lorenzo Bianconi, Matthias Brugger,
Peter Chiu, Ryder Lee, Sean Wang, Shayne Chen
> 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.
* You may occasionally put more than 53 characters into text lines
of such a change description.
* Would you like to use the term “null pointer dereference” consistently?
* Were any known source code analysis tools involved also for
this software improvement?
Regards,
Markus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-22 13:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-22 11:13 [PATCH] wifi: mt76: mt7996: avoid null deref in mt7996_stop_phy() Qasim Ijaz
2025-03-22 13:54 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox