]> git.itanic.dy.fi Git - linux-stable/commit
wifi: mac80211: Fix UAF in ieee80211_scan_rx()
authorSiddh Raman Pant <code@siddh.me>
Fri, 19 Aug 2022 20:03:40 +0000 (01:33 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Sep 2022 08:56:49 +0000 (10:56 +0200)
commite0ff39448cea654843744c72c6780293c5082cb1
tree50932ee74025054bda2a65aac42aebd634b689a8
parentd1fef7a4fa0b94ac9269a17e8c5eea06505677bc
wifi: mac80211: Fix UAF in ieee80211_scan_rx()

[ Upstream commit 60deb9f10eec5c6a20252ed36238b55d8b614a2c ]

ieee80211_scan_rx() tries to access scan_req->flags after a
null check, but a UAF is observed when the scan is completed
and __ieee80211_scan_completed() executes, which then calls
cfg80211_scan_done() leading to the freeing of scan_req.

Since scan_req is rcu_dereference()'d, prevent the racing in
__ieee80211_scan_completed() by ensuring that from mac80211's
POV it is no longer accessed from an RCU read critical section
before we call cfg80211_scan_done().

Cc: stable@vger.kernel.org
Link: https://syzkaller.appspot.com/bug?extid=f9acff9bf08a845f225d
Reported-by: syzbot+f9acff9bf08a845f225d@syzkaller.appspotmail.com
Suggested-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Siddh Raman Pant <code@siddh.me>
Link: https://lore.kernel.org/r/20220819200340.34826-1-code@siddh.me
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/mac80211/scan.c