Skip to content

Commit 296a7f7

Browse files
committed
wifi: mt76: scan: Fix 'mlink' dereferenced before IS_ERR_OR_NULL check
JIRA: https://issues.redhat.com/browse/RHEL-89168 commit 7e1fcf6 Author: Feng Jiang <jiangfeng@kylinos.cn> Date: Wed Apr 2 14:24:15 2025 +0800 wifi: mt76: scan: Fix 'mlink' dereferenced before IS_ERR_OR_NULL check Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202504011739.HvUKtUUe-lkp@intel.com/ Fixes: 3ba20af ("wifi: mt76: scan: set vif offchannel link for scanning/roc") Signed-off-by: Feng Jiang <jiangfeng@kylinos.cn> Link: https://patch.msgid.link/20250402062415.25434-1-jiangfeng@kylinos.cn Signed-off-by: Felix Fietkau <nbd@nbd.name> Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent a2c36e9 commit 296a7f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/net/wireless/mediatek/mt76/channel.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,13 @@ void mt76_put_vif_phy_link(struct mt76_phy *phy, struct ieee80211_vif *vif,
302302
struct mt76_vif_link *mlink)
303303
{
304304
struct mt76_dev *dev = phy->dev;
305-
struct mt76_vif_data *mvif = mlink->mvif;
305+
struct mt76_vif_data *mvif;
306306

307307
if (IS_ERR_OR_NULL(mlink) || !mlink->offchannel)
308308
return;
309309

310+
mvif = mlink->mvif;
311+
310312
rcu_assign_pointer(mvif->offchannel_link, NULL);
311313
dev->drv->vif_link_remove(phy, vif, &vif->bss_conf, mlink);
312314
kfree(mlink);

0 commit comments

Comments
 (0)