]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jul 2020 07:26:22 +0000 (09:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Jul 2020 07:26:22 +0000 (09:26 +0200)
added patches:
pm-wakeup-show-statistics-for-deleted-wakeup-sources-again.patch
regmap-debugfs-check-count-when-read-regmap-file.patch

queue-5.4/pm-wakeup-show-statistics-for-deleted-wakeup-sources-again.patch [new file with mode: 0644]
queue-5.4/regmap-debugfs-check-count-when-read-regmap-file.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/pm-wakeup-show-statistics-for-deleted-wakeup-sources-again.patch b/queue-5.4/pm-wakeup-show-statistics-for-deleted-wakeup-sources-again.patch
new file mode 100644 (file)
index 0000000..89e6ac7
--- /dev/null
@@ -0,0 +1,38 @@
+From e976eb4b91e906f20ec25b20c152d53c472fc3fd Mon Sep 17 00:00:00 2001
+From: zhuguangqing <zhuguangqing@xiaomi.com>
+Date: Mon, 9 Dec 2019 17:35:23 +0800
+Subject: PM: wakeup: Show statistics for deleted wakeup sources again
+
+From: zhuguangqing <zhuguangqing@xiaomi.com>
+
+commit e976eb4b91e906f20ec25b20c152d53c472fc3fd upstream.
+
+After commit 00ee22c28915 (PM / wakeup: Use seq_open() to show wakeup
+stats), print_wakeup_source_stats(m, &deleted_ws) is not called from
+wakeup_sources_stats_seq_show() any more.
+
+Because deleted_ws is one of the wakeup sources, it should be shown
+too, so add it to the end of all other wakeup sources.
+
+Signed-off-by: zhuguangqing <zhuguangqing@xiaomi.com>
+[ rjw: Subject & changelog ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/power/wakeup.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/base/power/wakeup.c
++++ b/drivers/base/power/wakeup.c
+@@ -1073,6 +1073,9 @@ static void *wakeup_sources_stats_seq_ne
+               break;
+       }
++      if (!next_ws)
++              print_wakeup_source_stats(m, &deleted_ws);
++
+       return next_ws;
+ }
diff --git a/queue-5.4/regmap-debugfs-check-count-when-read-regmap-file.patch b/queue-5.4/regmap-debugfs-check-count-when-read-regmap-file.patch
new file mode 100644 (file)
index 0000000..45b434f
--- /dev/null
@@ -0,0 +1,50 @@
+From 74edd08a4fbf51d65fd8f4c7d8289cd0f392bd91 Mon Sep 17 00:00:00 2001
+From: Peng Fan <peng.fan@nxp.com>
+Date: Fri, 13 Mar 2020 09:58:07 +0800
+Subject: regmap: debugfs: check count when read regmap file
+
+From: Peng Fan <peng.fan@nxp.com>
+
+commit 74edd08a4fbf51d65fd8f4c7d8289cd0f392bd91 upstream.
+
+When executing the following command, we met kernel dump.
+dmesg -c > /dev/null; cd /sys;
+for i in `ls /sys/kernel/debug/regmap/* -d`; do
+       echo "Checking regmap in $i";
+       cat $i/registers;
+done && grep -ri "0x02d0" *;
+
+It is because the count value is too big, and kmalloc fails. So add an
+upper bound check to allow max size `PAGE_SIZE << (MAX_ORDER - 1)`.
+
+Signed-off-by: Peng Fan <peng.fan@nxp.com>
+Link: https://lore.kernel.org/r/1584064687-12964-1-git-send-email-peng.fan@nxp.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/regmap/regmap-debugfs.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/base/regmap/regmap-debugfs.c
++++ b/drivers/base/regmap/regmap-debugfs.c
+@@ -227,6 +227,9 @@ static ssize_t regmap_read_debugfs(struc
+       if (*ppos < 0 || !count)
+               return -EINVAL;
++      if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
++              count = PAGE_SIZE << (MAX_ORDER - 1);
++
+       buf = kmalloc(count, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
+@@ -371,6 +374,9 @@ static ssize_t regmap_reg_ranges_read_fi
+       if (*ppos < 0 || !count)
+               return -EINVAL;
++      if (count > (PAGE_SIZE << (MAX_ORDER - 1)))
++              count = PAGE_SIZE << (MAX_ORDER - 1);
++
+       buf = kmalloc(count, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
index 9bf57187f0f2943d134c5bac01e8e392063bb525..6b9b77a36cf3793a1d490c0187fca6492ff70110 100644 (file)
@@ -14,3 +14,5 @@ sctp-shrink-stream-outq-only-when-new-outcnt-old-outcnt.patch
 sctp-shrink-stream-outq-when-fails-to-do-addstream-reconf.patch
 udp-copy-has_conns-in-reuseport_grow.patch
 udp-improve-load-balancing-for-so_reuseport.patch
+regmap-debugfs-check-count-when-read-regmap-file.patch
+pm-wakeup-show-statistics-for-deleted-wakeup-sources-again.patch