mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
wifi: mt76: mt7996: Check phy before init msta_link in mt7996_mac_sta_add_links()
In order to avoid a possible NULL pointer dereference in
mt7996_mac_sta_init_link routine, move the phy pointer check before
running mt7996_mac_sta_init_link() in mt7996_mac_sta_add_links routine.
Fixes: dd82a9e02c054 ("wifi: mt76: mt7996: Rely on mt7996_sta_link in sta_add/sta_remove callbacks")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Link: https://patch.msgid.link/20250830-mt7996_mac_sta_add_links-fix-v1-1-4219fb8755ee@kernel.org
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
de1df8b888
commit
27ad37728c
+6
-5
@@ -1073,16 +1073,17 @@ mt7996_mac_sta_add_links(struct mt7996_dev *dev, struct ieee80211_vif *vif,
|
|||||||
goto error_unlink;
|
goto error_unlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = mt7996_mac_sta_init_link(dev, link_conf, link_sta, link,
|
|
||||||
link_id);
|
|
||||||
if (err)
|
|
||||||
goto error_unlink;
|
|
||||||
|
|
||||||
mphy = mt76_vif_link_phy(&link->mt76);
|
mphy = mt76_vif_link_phy(&link->mt76);
|
||||||
if (!mphy) {
|
if (!mphy) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
goto error_unlink;
|
goto error_unlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = mt7996_mac_sta_init_link(dev, link_conf, link_sta, link,
|
||||||
|
link_id);
|
||||||
|
if (err)
|
||||||
|
goto error_unlink;
|
||||||
|
|
||||||
mphy->num_sta++;
|
mphy->num_sta++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user