]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Dec 2024 10:24:31 +0000 (11:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Dec 2024 10:24:31 +0000 (11:24 +0100)
added patches:
sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch
zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch

queue-5.15/series
queue-5.15/sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch [new file with mode: 0644]
queue-5.15/zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch [new file with mode: 0644]

index 4a3badc948523f8bd108fae4fbd2e16bc14db4db..00df4d086530b34daa8c0cfb7f04095d0a6742a2 100644 (file)
@@ -37,3 +37,5 @@ hwmon-tmp513-use-si-constants-from-units.h.patch
 hwmon-tmp513-fix-interpretation-of-values-of-shunt-v.patch
 hwmon-tmp513-fix-current-register-value-interpretati.patch
 hwmon-tmp513-fix-interpretation-of-values-of-tempera.patch
+sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch
+zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch
diff --git a/queue-5.15/sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch b/queue-5.15/sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch
new file mode 100644 (file)
index 0000000..c380fd0
--- /dev/null
@@ -0,0 +1,40 @@
+From ff30bd6a6618e979b16977617371c0f28a95036e Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+Date: Thu, 2 Feb 2023 17:20:55 +0100
+Subject: sh: clk: Fix clk_enable() to return 0 on NULL clk
+
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+
+commit ff30bd6a6618e979b16977617371c0f28a95036e upstream.
+
+On SH, devm_clk_get_optional_enabled() fails with -EINVAL if the clock
+is not found.  This happens because __devm_clk_get() assumes it can pass
+a NULL clock pointer (as returned by clk_get_optional()) to the init()
+function (clk_prepare_enable() in this case), while the SH
+implementation of clk_enable() considers that an error.
+
+Fix this by making the SH clk_enable() implementation return zero
+instead, like the Common Clock Framework does.
+
+Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Tested-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Acked-by: Stephen Boyd <sboyd@kernel.org>
+Link: https://lore.kernel.org/r/b53e6b557b4240579933b3359dda335ff94ed5af.1675354849.git.geert+renesas@glider.be
+Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/sh/clk/core.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/sh/clk/core.c
++++ b/drivers/sh/clk/core.c
+@@ -295,7 +295,7 @@ int clk_enable(struct clk *clk)
+       int ret;
+       if (!clk)
+-              return -EINVAL;
++              return 0;
+       spin_lock_irqsave(&clock_lock, flags);
+       ret = __clk_enable(clk);
diff --git a/queue-5.15/zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch b/queue-5.15/zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch
new file mode 100644 (file)
index 0000000..87f78b0
--- /dev/null
@@ -0,0 +1,61 @@
+From be48c412f6ebf38849213c19547bc6d5b692b5e5 Mon Sep 17 00:00:00 2001
+From: Kairui Song <kasong@tencent.com>
+Date: Tue, 10 Dec 2024 00:57:15 +0800
+Subject: zram: refuse to use zero sized block device as backing device
+
+From: Kairui Song <kasong@tencent.com>
+
+commit be48c412f6ebf38849213c19547bc6d5b692b5e5 upstream.
+
+Patch series "zram: fix backing device setup issue", v2.
+
+This series fixes two bugs of backing device setting:
+
+- ZRAM should reject using a zero sized (or the uninitialized ZRAM
+  device itself) as the backing device.
+- Fix backing device leaking when removing a uninitialized ZRAM
+  device.
+
+
+This patch (of 2):
+
+Setting a zero sized block device as backing device is pointless, and one
+can easily create a recursive loop by setting the uninitialized ZRAM
+device itself as its own backing device by (zram0 is uninitialized):
+
+    echo /dev/zram0 > /sys/block/zram0/backing_dev
+
+It's definitely a wrong config, and the module will pin itself, kernel
+should refuse doing so in the first place.
+
+By refusing to use zero sized device we avoided misuse cases including
+this one above.
+
+Link: https://lkml.kernel.org/r/20241209165717.94215-1-ryncsn@gmail.com
+Link: https://lkml.kernel.org/r/20241209165717.94215-2-ryncsn@gmail.com
+Fixes: 013bf95a83ec ("zram: add interface to specif backing device")
+Signed-off-by: Kairui Song <kasong@tencent.com>
+Reported-by: Desheng Wu <deshengwu@tencent.com>
+Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/zram/zram_drv.c |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/block/zram/zram_drv.c
++++ b/drivers/block/zram/zram_drv.c
+@@ -499,6 +499,12 @@ static ssize_t backing_dev_store(struct
+       }
+       nr_pages = i_size_read(inode) >> PAGE_SHIFT;
++      /* Refuse to use zero sized device (also prevents self reference) */
++      if (!nr_pages) {
++              err = -EINVAL;
++              goto out;
++      }
++
+       bitmap_sz = BITS_TO_LONGS(nr_pages) * sizeof(long);
+       bitmap = kvzalloc(bitmap_sz, GFP_KERNEL);
+       if (!bitmap) {