From bc5bc754a8c7f9cdc99ad682fdd5e3e905460876 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 30 Jul 2024 12:39:18 +0200 Subject: [PATCH] 5.10-stable patches added patches: drm-panfrost-mark-simple_ondemand-governor-as-softdep.patch mips-ip30-ip30-console-add-missing-include.patch mips-loongson64-env-hook-up-loongsson-2k.patch rbd-don-t-assume-rbd_is_lock_owner-for-exclusive-mappings.patch rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch selftests-sigaltstack-fix-ppc64-gcc-build.patch --- ...-simple_ondemand-governor-as-softdep.patch | 64 ++++++++++++++++ ...p30-ip30-console-add-missing-include.patch | 36 +++++++++ ...-loongson64-env-hook-up-loongsson-2k.patch | 65 ++++++++++++++++ ...is_lock_owner-for-exclusive-mappings.patch | 43 +++++++++++ ...er-free-related-to-destroying-cm-ids.patch | 74 +++++++++++++++++++ ...ests-sigaltstack-fix-ppc64-gcc-build.patch | 48 ++++++++++++ queue-5.10/series | 6 ++ 7 files changed, 336 insertions(+) create mode 100644 queue-5.10/drm-panfrost-mark-simple_ondemand-governor-as-softdep.patch create mode 100644 queue-5.10/mips-ip30-ip30-console-add-missing-include.patch create mode 100644 queue-5.10/mips-loongson64-env-hook-up-loongsson-2k.patch create mode 100644 queue-5.10/rbd-don-t-assume-rbd_is_lock_owner-for-exclusive-mappings.patch create mode 100644 queue-5.10/rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch create mode 100644 queue-5.10/selftests-sigaltstack-fix-ppc64-gcc-build.patch diff --git a/queue-5.10/drm-panfrost-mark-simple_ondemand-governor-as-softdep.patch b/queue-5.10/drm-panfrost-mark-simple_ondemand-governor-as-softdep.patch new file mode 100644 index 00000000000..d310ac254fe --- /dev/null +++ b/queue-5.10/drm-panfrost-mark-simple_ondemand-governor-as-softdep.patch @@ -0,0 +1,64 @@ +From 80f4e62730a91572b7fdc657f7bb747e107ae308 Mon Sep 17 00:00:00 2001 +From: Dragan Simic +Date: Mon, 17 Jun 2024 22:17:48 +0200 +Subject: drm/panfrost: Mark simple_ondemand governor as softdep + +From: Dragan Simic + +commit 80f4e62730a91572b7fdc657f7bb747e107ae308 upstream. + +Panfrost DRM driver uses devfreq to perform DVFS, while using simple_ondemand +devfreq governor by default. This causes driver initialization to fail on +boot when simple_ondemand governor isn't built into the kernel statically, +as a result of the missing module dependency and, consequently, the required +governor module not being included in the initial ramdisk. Thus, let's mark +simple_ondemand governor as a softdep for Panfrost, to have its kernel module +included in the initial ramdisk. + +This is a rather longstanding issue that has forced distributions to build +devfreq governors statically into their kernels, [1][2] or has forced users +to introduce some unnecessary workarounds. [3] + +For future reference, not having support for the simple_ondemand governor in +the initial ramdisk produces errors in the kernel log similar to these below, +which were taken from a Pine64 RockPro64: + + panfrost ff9a0000.gpu: [drm:panfrost_devfreq_init [panfrost]] *ERROR* Couldn't initialize GPU devfreq + panfrost ff9a0000.gpu: Fatal error during GPU init + panfrost: probe of ff9a0000.gpu failed with error -22 + +Having simple_ondemand marked as a softdep for Panfrost may not resolve this +issue for all Linux distributions. In particular, it will remain unresolved +for the distributions whose utilities for the initial ramdisk generation do +not handle the available softdep information [4] properly yet. However, some +Linux distributions already handle softdeps properly while generating their +initial ramdisks, [5] and this is a prerequisite step in the right direction +for the distributions that don't handle them properly yet. + +[1] https://gitlab.manjaro.org/manjaro-arm/packages/core/linux/-/blob/linux61/config?ref_type=heads#L8180 +[2] https://salsa.debian.org/kernel-team/linux/-/merge_requests/1066 +[3] https://forum.pine64.org/showthread.php?tid=15458 +[4] https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git/commit/?id=49d8e0b59052999de577ab732b719cfbeb89504d +[5] https://github.com/archlinux/mkinitcpio/commit/97ac4d37aae084a050be512f6d8f4489054668ad + +Cc: Diederik de Haas +Cc: Furkan Kardame +Cc: stable@vger.kernel.org +Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") +Signed-off-by: Dragan Simic +Reviewed-by: Steven Price +Reviewed-by: Boris Brezillon +Signed-off-by: Steven Price +Link: https://patchwork.freedesktop.org/patch/msgid/4e1e00422a14db4e2a80870afb704405da16fd1b.1718655077.git.dsimic@manjaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/panfrost/panfrost_drv.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/gpu/drm/panfrost/panfrost_drv.c ++++ b/drivers/gpu/drm/panfrost/panfrost_drv.c +@@ -681,3 +681,4 @@ module_platform_driver(panfrost_driver); + MODULE_AUTHOR("Panfrost Project Developers"); + MODULE_DESCRIPTION("Panfrost DRM Driver"); + MODULE_LICENSE("GPL v2"); ++MODULE_SOFTDEP("pre: governor_simpleondemand"); diff --git a/queue-5.10/mips-ip30-ip30-console-add-missing-include.patch b/queue-5.10/mips-ip30-ip30-console-add-missing-include.patch new file mode 100644 index 00000000000..1009e903871 --- /dev/null +++ b/queue-5.10/mips-ip30-ip30-console-add-missing-include.patch @@ -0,0 +1,36 @@ +From 8de4ed75bd14ed197119ac509c6902a8561e0c1c Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Sun, 16 Jun 2024 18:54:24 +0100 +Subject: MIPS: ip30: ip30-console: Add missing include +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jiaxun Yang + +commit 8de4ed75bd14ed197119ac509c6902a8561e0c1c upstream. + +Include linux/processor.h to fix build error: + +arch/mips/sgi-ip30/ip30-console.c: In function ‘prom_putchar’: +arch/mips/sgi-ip30/ip30-console.c:21:17: error: implicit declaration of function ‘cpu_relax’ [-Werror=implicit-function-declaration] + 21 | cpu_relax(); + +Cc: stable@vger.kernel.org +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/sgi-ip30/ip30-console.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/mips/sgi-ip30/ip30-console.c ++++ b/arch/mips/sgi-ip30/ip30-console.c +@@ -1,6 +1,7 @@ + // SPDX-License-Identifier: GPL-2.0 + + #include ++#include + + #include + diff --git a/queue-5.10/mips-loongson64-env-hook-up-loongsson-2k.patch b/queue-5.10/mips-loongson64-env-hook-up-loongsson-2k.patch new file mode 100644 index 00000000000..6941eeeb80a --- /dev/null +++ b/queue-5.10/mips-loongson64-env-hook-up-loongsson-2k.patch @@ -0,0 +1,65 @@ +From 77543269ff23c75bebfb8e6e9a1177b350908ea7 Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Fri, 14 Jun 2024 16:40:18 +0100 +Subject: MIPS: Loongson64: env: Hook up Loongsson-2K + +From: Jiaxun Yang + +commit 77543269ff23c75bebfb8e6e9a1177b350908ea7 upstream. + +Somehow those enablement bits were left over when we were +adding initial Loongson-2K support. + +Set up basic information and select proper builtin DTB for +Loongson-2K. + +Cc: stable@vger.kernel.org +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/include/asm/mach-loongson64/boot_param.h | 2 ++ + arch/mips/loongson64/env.c | 8 ++++++++ + 2 files changed, 10 insertions(+) + +--- a/arch/mips/include/asm/mach-loongson64/boot_param.h ++++ b/arch/mips/include/asm/mach-loongson64/boot_param.h +@@ -38,12 +38,14 @@ enum loongson_cpu_type { + Legacy_1B = 0x5, + Legacy_2G = 0x6, + Legacy_2H = 0x7, ++ Legacy_2K = 0x8, + Loongson_1A = 0x100, + Loongson_1B = 0x101, + Loongson_2E = 0x200, + Loongson_2F = 0x201, + Loongson_2G = 0x202, + Loongson_2H = 0x203, ++ Loongson_2K = 0x204, + Loongson_3A = 0x300, + Loongson_3B = 0x301 + }; +--- a/arch/mips/loongson64/env.c ++++ b/arch/mips/loongson64/env.c +@@ -65,6 +65,12 @@ void __init prom_init_env(void) + cpu_clock_freq = ecpu->cpu_clock_freq; + loongson_sysconf.cputype = ecpu->cputype; + switch (ecpu->cputype) { ++ case Legacy_2K: ++ case Loongson_2K: ++ smp_group[0] = 0x900000001fe11000; ++ loongson_sysconf.cores_per_node = 2; ++ loongson_sysconf.cores_per_package = 2; ++ break; + case Legacy_3A: + case Loongson_3A: + loongson_sysconf.cores_per_node = 4; +@@ -213,6 +219,8 @@ void __init prom_init_env(void) + default: + break; + } ++ } else if ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64R) { ++ loongson_fdt_blob = __dtb_loongson64_2core_2k1000_begin; + } else if ((read_c0_prid() & PRID_IMP_MASK) == PRID_IMP_LOONGSON_64G) { + if (loongson_sysconf.bridgetype == LS7A) + loongson_fdt_blob = __dtb_loongson64g_4core_ls7a_begin; diff --git a/queue-5.10/rbd-don-t-assume-rbd_is_lock_owner-for-exclusive-mappings.patch b/queue-5.10/rbd-don-t-assume-rbd_is_lock_owner-for-exclusive-mappings.patch new file mode 100644 index 00000000000..cba5770584b --- /dev/null +++ b/queue-5.10/rbd-don-t-assume-rbd_is_lock_owner-for-exclusive-mappings.patch @@ -0,0 +1,43 @@ +From 3ceccb14f5576e02b81cc8b105ab81f224bd87f6 Mon Sep 17 00:00:00 2001 +From: Ilya Dryomov +Date: Tue, 23 Jul 2024 18:08:08 +0200 +Subject: rbd: don't assume rbd_is_lock_owner() for exclusive mappings + +From: Ilya Dryomov + +commit 3ceccb14f5576e02b81cc8b105ab81f224bd87f6 upstream. + +Expanding on the previous commit, assuming that rbd_is_lock_owner() +always returns true (i.e. that we are either in RBD_LOCK_STATE_LOCKED +or RBD_LOCK_STATE_QUIESCING) if the mapping is exclusive is wrong too. +In case ceph_cls_set_cookie() fails, the lock would be temporarily +released even if the mapping is exclusive, meaning that we can end up +even in RBD_LOCK_STATE_UNLOCKED. + +IOW, exclusive mappings are really "just" about disabling automatic +lock transitions (as documented in the man page), not about grabbing +the lock and holding on to it whatever it takes. + +Cc: stable@vger.kernel.org +Fixes: 637cd060537d ("rbd: new exclusive lock wait/wake code") +Signed-off-by: Ilya Dryomov +Reviewed-by: Dongsheng Yang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/block/rbd.c | 5 ----- + 1 file changed, 5 deletions(-) + +--- a/drivers/block/rbd.c ++++ b/drivers/block/rbd.c +@@ -6660,11 +6660,6 @@ static int rbd_add_acquire_lock(struct r + if (ret) + return ret; + +- /* +- * The lock may have been released by now, unless automatic lock +- * transitions are disabled. +- */ +- rbd_assert(!rbd_dev->opts->exclusive || rbd_is_lock_owner(rbd_dev)); + return 0; + } + diff --git a/queue-5.10/rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch b/queue-5.10/rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch new file mode 100644 index 00000000000..f1b37a9a503 --- /dev/null +++ b/queue-5.10/rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch @@ -0,0 +1,74 @@ +From aee2424246f9f1dadc33faa78990c1e2eb7826e4 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Wed, 5 Jun 2024 08:51:01 -0600 +Subject: RDMA/iwcm: Fix a use-after-free related to destroying CM IDs + +From: Bart Van Assche + +commit aee2424246f9f1dadc33faa78990c1e2eb7826e4 upstream. + +iw_conn_req_handler() associates a new struct rdma_id_private (conn_id) with +an existing struct iw_cm_id (cm_id) as follows: + + conn_id->cm_id.iw = cm_id; + cm_id->context = conn_id; + cm_id->cm_handler = cma_iw_handler; + +rdma_destroy_id() frees both the cm_id and the struct rdma_id_private. Make +sure that cm_work_handler() does not trigger a use-after-free by only +freeing of the struct rdma_id_private after all pending work has finished. + +Cc: stable@vger.kernel.org +Fixes: 59c68ac31e15 ("iw_cm: free cm_id resources on the last deref") +Reviewed-by: Zhu Yanjun +Tested-by: Shin'ichiro Kawasaki +Signed-off-by: Bart Van Assche +Link: https://lore.kernel.org/r/20240605145117.397751-6-bvanassche@acm.org +Signed-off-by: Leon Romanovsky +Signed-off-by: Greg Kroah-Hartman +--- + drivers/infiniband/core/iwcm.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/drivers/infiniband/core/iwcm.c ++++ b/drivers/infiniband/core/iwcm.c +@@ -370,8 +370,10 @@ EXPORT_SYMBOL(iw_cm_disconnect); + * + * Clean up all resources associated with the connection and release + * the initial reference taken by iw_create_cm_id. ++ * ++ * Returns true if and only if the last cm_id_priv reference has been dropped. + */ +-static void destroy_cm_id(struct iw_cm_id *cm_id) ++static bool destroy_cm_id(struct iw_cm_id *cm_id) + { + struct iwcm_id_private *cm_id_priv; + struct ib_qp *qp; +@@ -441,7 +443,7 @@ static void destroy_cm_id(struct iw_cm_i + iwpm_remove_mapping(&cm_id->local_addr, RDMA_NL_IWCM); + } + +- (void)iwcm_deref_id(cm_id_priv); ++ return iwcm_deref_id(cm_id_priv); + } + + /* +@@ -452,7 +454,8 @@ static void destroy_cm_id(struct iw_cm_i + */ + void iw_destroy_cm_id(struct iw_cm_id *cm_id) + { +- destroy_cm_id(cm_id); ++ if (!destroy_cm_id(cm_id)) ++ flush_workqueue(iwcm_wq); + } + EXPORT_SYMBOL(iw_destroy_cm_id); + +@@ -1036,7 +1039,7 @@ static void cm_work_handler(struct work_ + if (!test_bit(IWCM_F_DROP_EVENTS, &cm_id_priv->flags)) { + ret = process_event(cm_id_priv, &levent); + if (ret) +- destroy_cm_id(&cm_id_priv->id); ++ WARN_ON_ONCE(destroy_cm_id(&cm_id_priv->id)); + } else + pr_debug("dropping event %d\n", levent.event); + if (iwcm_deref_id(cm_id_priv)) diff --git a/queue-5.10/selftests-sigaltstack-fix-ppc64-gcc-build.patch b/queue-5.10/selftests-sigaltstack-fix-ppc64-gcc-build.patch new file mode 100644 index 00000000000..a1caf44e0ae --- /dev/null +++ b/queue-5.10/selftests-sigaltstack-fix-ppc64-gcc-build.patch @@ -0,0 +1,48 @@ +From 17c743b9da9e0d073ff19fd5313f521744514939 Mon Sep 17 00:00:00 2001 +From: Michael Ellerman +Date: Mon, 20 May 2024 16:26:47 +1000 +Subject: selftests/sigaltstack: Fix ppc64 GCC build +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Michael Ellerman + +commit 17c743b9da9e0d073ff19fd5313f521744514939 upstream. + +Building the sigaltstack test with GCC on 64-bit powerpc errors with: + + gcc -Wall sas.c -o /home/michael/linux/.build/kselftest/sigaltstack/sas + In file included from sas.c:23: + current_stack_pointer.h:22:2: error: #error "implement current_stack_pointer equivalent" + 22 | #error "implement current_stack_pointer equivalent" + | ^~~~~ + sas.c: In function ‘my_usr1’: + sas.c:50:13: error: ‘sp’ undeclared (first use in this function); did you mean ‘p’? + 50 | if (sp < (unsigned long)sstack || + | ^~ + +This happens because GCC doesn't define __ppc__ for 64-bit builds, only +32-bit builds. Instead use __powerpc__ to detect powerpc builds, which +is defined by clang and GCC for 64-bit and 32-bit builds. + +Fixes: 05107edc9101 ("selftests: sigaltstack: fix -Wuninitialized") +Cc: stable@vger.kernel.org # v6.3+ +Signed-off-by: Michael Ellerman +Link: https://msgid.link/20240520062647.688667-1-mpe@ellerman.id.au +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/sigaltstack/current_stack_pointer.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/testing/selftests/sigaltstack/current_stack_pointer.h ++++ b/tools/testing/selftests/sigaltstack/current_stack_pointer.h +@@ -8,7 +8,7 @@ register unsigned long sp asm("sp"); + register unsigned long sp asm("esp"); + #elif __loongarch64 + register unsigned long sp asm("$sp"); +-#elif __ppc__ ++#elif __powerpc__ + register unsigned long sp asm("r1"); + #elif __s390x__ + register unsigned long sp asm("%15"); diff --git a/queue-5.10/series b/queue-5.10/series index 068d10d0bea..7e3399e68f7 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -173,3 +173,9 @@ perf-x86-intel-pt-fix-a-topa_entry-base-address-calculation.patch rtc-isl1208-fix-return-value-of-nvmem-callbacks.patch watchdog-perf-properly-initialize-the-turbo-mode-timestamp-and-rearm-counter.patch platform-mips-cpu_hwmon-disable-driver-on-unsupported-hardware.patch +rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch +selftests-sigaltstack-fix-ppc64-gcc-build.patch +rbd-don-t-assume-rbd_is_lock_owner-for-exclusive-mappings.patch +mips-ip30-ip30-console-add-missing-include.patch +mips-loongson64-env-hook-up-loongsson-2k.patch +drm-panfrost-mark-simple_ondemand-governor-as-softdep.patch -- 2.47.3