Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0116f6f authored by Colin Ian King's avatar Colin Ian King Committed by Kalle Valo
Browse files

rtlwifi: kfree entry until after entry->bssid has been accessed



The current code kfree's entry and then dereferences it by accessing
entry->bssid.  Avoid the dereference-after-free by moving the kfree
after the access to entry->bssid.

Detected by CoverityScan, CID#1448600 ("Read from pointer after free")

Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent 4b5dde2d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1735,12 +1735,12 @@ void rtl_scan_list_expire(struct ieee80211_hw *hw)
			continue;

		list_del(&entry->list);
		kfree(entry);
		rtlpriv->scan_list.num--;

		RT_TRACE(rtlpriv, COMP_SCAN, DBG_LOUD,
			 "BSSID=%pM is expire in scan list (total=%d)\n",
			 entry->bssid, rtlpriv->scan_list.num);
		kfree(entry);
	}

	spin_unlock_irqrestore(&rtlpriv->locks.scan_list_lock, flags);