]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Fri, 23 Sep 2022 16:54:13 +0000 (12:54 -0400)
committerSasha Levin <sashal@kernel.org>
Fri, 23 Sep 2022 16:54:13 +0000 (12:54 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/series
queue-4.14/wifi-mac80211-fix-uaf-in-ieee80211_scan_rx.patch [new file with mode: 0644]

index 84d7bb93de6261693da342f7a1f6f72055d9263f..bbab005cd668bf6ce5affb46ac6508eb93469ecc 100644 (file)
@@ -13,3 +13,4 @@ mips-octeon-irq-fix-octeon_irq_force_ciu_mapping.patch
 mksysmap-fix-the-mismatch-of-l0-symbols-in-system.ma.patch
 video-fbdev-pxa3xx-gcu-fix-integer-overflow-in-pxa3x.patch
 alsa-hda-sigmatel-fix-unused-variable-warning-for-beep-power-change.patch
+wifi-mac80211-fix-uaf-in-ieee80211_scan_rx.patch
diff --git a/queue-4.14/wifi-mac80211-fix-uaf-in-ieee80211_scan_rx.patch b/queue-4.14/wifi-mac80211-fix-uaf-in-ieee80211_scan_rx.patch
new file mode 100644 (file)
index 0000000..7fc8b3c
--- /dev/null
@@ -0,0 +1,63 @@
+From 6099a84f4b94674bd8a2e9632e8930119cc818a0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 20 Aug 2022 01:33:40 +0530
+Subject: wifi: mac80211: Fix UAF in ieee80211_scan_rx()
+
+From: Siddh Raman Pant <code@siddh.me>
+
+[ 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 | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
+index dd9d7c4b7f2d..5df8f393c119 100644
+--- a/net/mac80211/scan.c
++++ b/net/mac80211/scan.c
+@@ -385,10 +385,6 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
+       scan_req = rcu_dereference_protected(local->scan_req,
+                                            lockdep_is_held(&local->mtx));
+-      if (scan_req != local->int_scan_req) {
+-              local->scan_info.aborted = aborted;
+-              cfg80211_scan_done(scan_req, &local->scan_info);
+-      }
+       RCU_INIT_POINTER(local->scan_req, NULL);
+       scan_sdata = rcu_dereference_protected(local->scan_sdata,
+@@ -398,6 +394,13 @@ static void __ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
+       local->scanning = 0;
+       local->scan_chandef.chan = NULL;
++      synchronize_rcu();
++
++      if (scan_req != local->int_scan_req) {
++              local->scan_info.aborted = aborted;
++              cfg80211_scan_done(scan_req, &local->scan_info);
++      }
++
+       /* Set power back to normal operating levels. */
+       ieee80211_hw_config(local, 0);
+-- 
+2.35.1
+