wifi: mt76: scan: Fix 'mlink' dereferenced before IS_ERR_OR_NULL check

Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Fixes: 3ba20af886d1 ("wifi: mt76: scan: set vif offchannel link for scanning/roc")
Signed-off-by: Feng Jiang <[email protected]>
Link: https://patch.msgid.link/[email protected]
This commit is contained in:
Feng Jiang
2025-05-21 14:30:01 +02:00
committed by Felix Fietkau
parent ca76c1bced
commit b70a4a6195
+3 -1
View File
@@ -302,11 +302,13 @@ void mt76_put_vif_phy_link(struct mt76_phy *phy, struct ieee80211_vif *vif,
struct mt76_vif_link *mlink)
{
struct mt76_dev *dev = phy->dev;
struct mt76_vif_data *mvif = mlink->mvif;
struct mt76_vif_data *mvif;
if (IS_ERR_OR_NULL(mlink) || !mlink->offchannel)
return;
mvif = mlink->mvif;
rcu_assign_pointer(mvif->offchannel_link, NULL);
dev->drv->vif_link_remove(phy, vif, &vif->bss_conf, mlink);
kfree(mlink);