Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wifi: cfg80211: fix use-after-free in cmp_bss()

Following bss_free() quirk introduced in commit 776b3580178f
("cfg80211: track hidden SSID networks properly"), adjust
cfg80211_update_known_bss() to free the last beacon frame
elements only if they're not shared via the corresponding
'hidden_beacon_bss' pointer.

Reported-by: syzbot+30754ca335e6fb7e3092@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=30754ca335e6fb7e3092
Fixes: 3ab8227d3e7d ("cfg80211: refactor cfg80211_bss_update")
Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
Link: https://patch.msgid.link/20250813135236.799384-1-dmantipov@yandex.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>

authored by

Dmitry Antipov and committed by
Johannes Berg
26e84445 f64768be

+2 -1
+2 -1
net/wireless/scan.c
··· 1916 1916 */ 1917 1917 1918 1918 f = rcu_access_pointer(new->pub.beacon_ies); 1919 - kfree_rcu((struct cfg80211_bss_ies *)f, rcu_head); 1919 + if (!new->pub.hidden_beacon_bss) 1920 + kfree_rcu((struct cfg80211_bss_ies *)f, rcu_head); 1920 1921 return false; 1921 1922 } 1922 1923