From: Greg Kroah-Hartman Date: Tue, 30 Jul 2024 10:38:57 +0000 (+0200) Subject: 4.19-stable patches X-Git-Tag: v6.1.103~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=faca9a83972f6b6098dfcdb6e8055676277914ae;p=thirdparty%2Fkernel%2Fstable-queue.git 4.19-stable patches added patches: 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 --- diff --git a/queue-4.19/platform-mips-cpu_hwmon-disable-driver-on-unsupported-hardware.patch b/queue-4.19/platform-mips-cpu_hwmon-disable-driver-on-unsupported-hardware.patch new file mode 100644 index 00000000000..2f77aa8cba2 --- /dev/null +++ b/queue-4.19/platform-mips-cpu_hwmon-disable-driver-on-unsupported-hardware.patch @@ -0,0 +1,32 @@ +From f4d430db17b4ef4e9c3c352a04b2fe3c93011978 Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Fri, 14 Jun 2024 16:40:15 +0100 +Subject: platform: mips: cpu_hwmon: Disable driver on unsupported hardware + +From: Jiaxun Yang + +commit f4d430db17b4ef4e9c3c352a04b2fe3c93011978 upstream. + +cpu_hwmon is unsupported on CPUs without loongson_chiptemp +register and csr. + +Cc: stable@vger.kernel.org +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + drivers/platform/mips/cpu_hwmon.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/platform/mips/cpu_hwmon.c ++++ b/drivers/platform/mips/cpu_hwmon.c +@@ -164,6 +164,9 @@ static int __init loongson_hwmon_init(vo + goto fail_hwmon_device_register; + } + ++ if (!csr_temp_enable && !loongson_chiptemp[0]) ++ return -ENODEV; ++ + nr_packages = loongson_sysconf.nr_cpus / + loongson_sysconf.cores_per_package; + diff --git a/queue-4.19/rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch b/queue-4.19/rdma-iwcm-fix-a-use-after-free-related-to-destroying-cm-ids.patch new file mode 100644 index 00000000000..dfedc3344b7 --- /dev/null +++ b/queue-4.19/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 +@@ -369,8 +369,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; + unsigned long flags; +@@ -438,7 +440,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); + } + + /* +@@ -449,7 +451,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); + +@@ -1022,7 +1025,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-4.19/selftests-sigaltstack-fix-ppc64-gcc-build.patch b/queue-4.19/selftests-sigaltstack-fix-ppc64-gcc-build.patch new file mode 100644 index 00000000000..a1caf44e0ae --- /dev/null +++ b/queue-4.19/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-4.19/series b/queue-4.19/series index 96709606969..ad17da706e7 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -88,3 +88,6 @@ scsi-qla2xxx-during-vport-delete-send-async-logout-explicitly.patch scsi-qla2xxx-validate-nvme_local_port-correctly.patch perf-x86-intel-pt-fix-topa_entry-base-length.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