From: Greg Kroah-Hartman Date: Mon, 23 Dec 2024 10:24:21 +0000 (+0100) Subject: 5.10-stable patches X-Git-Tag: v6.1.122~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b0af78f3436d5d30681302b7ac7ffb794966e351;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches 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 --- diff --git a/queue-5.10/series b/queue-5.10/series index bdd5144742b..bcd8d461dc9 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -29,3 +29,5 @@ usb-serial-option-add-mediatek-t7xx-compositions.patch usb-serial-option-add-telit-fe910c04-rmnet-compositions.patch drm-modes-avoid-divide-by-zero-harder-in-drm_mode_vrefresh.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.10/sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch b/queue-5.10/sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch new file mode 100644 index 00000000000..c380fd07c89 --- /dev/null +++ b/queue-5.10/sh-clk-fix-clk_enable-to-return-0-on-null-clk.patch @@ -0,0 +1,40 @@ +From ff30bd6a6618e979b16977617371c0f28a95036e Mon Sep 17 00:00:00 2001 +From: Geert Uytterhoeven +Date: Thu, 2 Feb 2023 17:20:55 +0100 +Subject: sh: clk: Fix clk_enable() to return 0 on NULL clk + +From: Geert Uytterhoeven + +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 +Signed-off-by: Geert Uytterhoeven +Tested-by: John Paul Adrian Glaubitz +Acked-by: Stephen Boyd +Link: https://lore.kernel.org/r/b53e6b557b4240579933b3359dda335ff94ed5af.1675354849.git.geert+renesas@glider.be +Signed-off-by: John Paul Adrian Glaubitz +Signed-off-by: Greg Kroah-Hartman +--- + 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.10/zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch b/queue-5.10/zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch new file mode 100644 index 00000000000..514a5ebf841 --- /dev/null +++ b/queue-5.10/zram-refuse-to-use-zero-sized-block-device-as-backing-device.patch @@ -0,0 +1,61 @@ +From be48c412f6ebf38849213c19547bc6d5b692b5e5 Mon Sep 17 00:00:00 2001 +From: Kairui Song +Date: Tue, 10 Dec 2024 00:57:15 +0800 +Subject: zram: refuse to use zero sized block device as backing device + +From: Kairui Song + +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 +Reported-by: Desheng Wu +Reviewed-by: Sergey Senozhatsky +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Greg Kroah-Hartman +--- + 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 +@@ -502,6 +502,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) {