]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.13-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Jul 2021 08:05:00 +0000 (10:05 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Jul 2021 08:05:00 +0000 (10:05 +0200)
added patches:
cfg80211-fix-possible-memory-leak-in-function-cfg80211_bss_update.patch

queue-5.13/cfg80211-fix-possible-memory-leak-in-function-cfg80211_bss_update.patch [new file with mode: 0644]
queue-5.13/series

diff --git a/queue-5.13/cfg80211-fix-possible-memory-leak-in-function-cfg80211_bss_update.patch b/queue-5.13/cfg80211-fix-possible-memory-leak-in-function-cfg80211_bss_update.patch
new file mode 100644 (file)
index 0000000..1375e92
--- /dev/null
@@ -0,0 +1,45 @@
+From f9a5c358c8d26fed0cc45f2afc64633d4ba21dff Mon Sep 17 00:00:00 2001
+From: Nguyen Dinh Phi <phind.uet@gmail.com>
+Date: Mon, 28 Jun 2021 21:23:34 +0800
+Subject: cfg80211: Fix possible memory leak in function cfg80211_bss_update
+
+From: Nguyen Dinh Phi <phind.uet@gmail.com>
+
+commit f9a5c358c8d26fed0cc45f2afc64633d4ba21dff upstream.
+
+When we exceed the limit of BSS entries, this function will free the
+new entry, however, at this time, it is the last door to access the
+inputed ies, so these ies will be unreferenced objects and cause memory
+leak.
+Therefore we should free its ies before deallocating the new entry, beside
+of dropping it from hidden_list.
+
+Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
+Link: https://lore.kernel.org/r/20210628132334.851095-1-phind.uet@gmail.com
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/wireless/scan.c |    6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+--- a/net/wireless/scan.c
++++ b/net/wireless/scan.c
+@@ -1744,16 +1744,14 @@ cfg80211_bss_update(struct cfg80211_regi
+                        * be grouped with this beacon for updates ...
+                        */
+                       if (!cfg80211_combine_bsses(rdev, new)) {
+-                              kfree(new);
++                              bss_ref_put(rdev, new);
+                               goto drop;
+                       }
+               }
+               if (rdev->bss_entries >= bss_entries_limit &&
+                   !cfg80211_bss_expire_oldest(rdev)) {
+-                      if (!list_empty(&new->hidden_list))
+-                              list_del(&new->hidden_list);
+-                      kfree(new);
++                      bss_ref_put(rdev, new);
+                       goto drop;
+               }
index c97e5245f8a3fbfae9c6137927a3b8d3e81e23ae..a02203e2e93ddee31795d43dfffc3868a0869e26 100644 (file)
@@ -31,3 +31,4 @@ nfc-nfcsim-fix-use-after-free-during-module-unload.patch
 io_uring-fix-io_prep_async_link-locking.patch
 io_uring-don-t-block-level-reissue-off-completion-path.patch
 io_uring-fix-poll-requests-leaking-second-poll-entries.patch
+cfg80211-fix-possible-memory-leak-in-function-cfg80211_bss_update.patch