Commit 7e1fcf68 authored by Feng Jiang's avatar Feng Jiang Committed by Felix Fietkau
Browse files

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

parent c29f2c77
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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);