From: Greg Kroah-Hartman Date: Thu, 17 Apr 2025 13:35:56 +0000 (+0200) Subject: 5.4-stable patches X-Git-Tag: v6.12.24~52 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3ff1ef82bf20bb3baf617338249ba1a993f786e0;p=thirdparty%2Fkernel%2Fstable-queue.git 5.4-stable patches added patches: crypto-ccp-fix-check-for-the-primary-asp-device.patch dm-integrity-set-ti-error-on-memory-allocation-failure.patch ftrace-add-cond_resched-to-ftrace_graph_set_hash.patch gpio-zynq-fix-wakeup-source-leaks-on-device-unbind.patch thermal-drivers-rockchip-add-missing-rk3328-mapping-entry.patch --- diff --git a/queue-5.4/crypto-ccp-fix-check-for-the-primary-asp-device.patch b/queue-5.4/crypto-ccp-fix-check-for-the-primary-asp-device.patch new file mode 100644 index 0000000000..d9de13e05a --- /dev/null +++ b/queue-5.4/crypto-ccp-fix-check-for-the-primary-asp-device.patch @@ -0,0 +1,54 @@ +From 07bb097b92b987db518e72525b515d77904e966e Mon Sep 17 00:00:00 2001 +From: Tom Lendacky +Date: Fri, 17 Jan 2025 17:05:47 -0600 +Subject: crypto: ccp - Fix check for the primary ASP device + +From: Tom Lendacky + +commit 07bb097b92b987db518e72525b515d77904e966e upstream. + +Currently, the ASP primary device check does not have support for PCI +domains, and, as a result, when the system is configured with PCI domains +(PCI segments) the wrong device can be selected as primary. This results +in commands submitted to the device timing out and failing. The device +check also relies on specific device and function assignments that may +not hold in the future. + +Fix the primary ASP device check to include support for PCI domains and +to perform proper checking of the Bus/Device/Function positions. + +Fixes: 2a6170dfe755 ("crypto: ccp: Add Platform Security Processor (PSP) device support") +Cc: stable@vger.kernel.org +Signed-off-by: Tom Lendacky +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + drivers/crypto/ccp/sp-pci.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +--- a/drivers/crypto/ccp/sp-pci.c ++++ b/drivers/crypto/ccp/sp-pci.c +@@ -118,14 +118,17 @@ static bool sp_pci_is_master(struct sp_d + pdev_new = to_pci_dev(dev_new); + pdev_cur = to_pci_dev(dev_cur); + +- if (pdev_new->bus->number < pdev_cur->bus->number) +- return true; ++ if (pci_domain_nr(pdev_new->bus) != pci_domain_nr(pdev_cur->bus)) ++ return pci_domain_nr(pdev_new->bus) < pci_domain_nr(pdev_cur->bus); + +- if (PCI_SLOT(pdev_new->devfn) < PCI_SLOT(pdev_cur->devfn)) +- return true; ++ if (pdev_new->bus->number != pdev_cur->bus->number) ++ return pdev_new->bus->number < pdev_cur->bus->number; + +- if (PCI_FUNC(pdev_new->devfn) < PCI_FUNC(pdev_cur->devfn)) +- return true; ++ if (PCI_SLOT(pdev_new->devfn) != PCI_SLOT(pdev_cur->devfn)) ++ return PCI_SLOT(pdev_new->devfn) < PCI_SLOT(pdev_cur->devfn); ++ ++ if (PCI_FUNC(pdev_new->devfn) != PCI_FUNC(pdev_cur->devfn)) ++ return PCI_FUNC(pdev_new->devfn) < PCI_FUNC(pdev_cur->devfn); + + return false; + } diff --git a/queue-5.4/dm-integrity-set-ti-error-on-memory-allocation-failure.patch b/queue-5.4/dm-integrity-set-ti-error-on-memory-allocation-failure.patch new file mode 100644 index 0000000000..ee11c2b697 --- /dev/null +++ b/queue-5.4/dm-integrity-set-ti-error-on-memory-allocation-failure.patch @@ -0,0 +1,41 @@ +From 00204ae3d6712ee053353920e3ce2b00c35ef75b Mon Sep 17 00:00:00 2001 +From: Mikulas Patocka +Date: Mon, 10 Feb 2025 16:14:22 +0100 +Subject: dm-integrity: set ti->error on memory allocation failure + +From: Mikulas Patocka + +commit 00204ae3d6712ee053353920e3ce2b00c35ef75b upstream. + +The dm-integrity target didn't set the error string when memory +allocation failed. This patch fixes it. + +Signed-off-by: Mikulas Patocka +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/md/dm-integrity.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/md/dm-integrity.c ++++ b/drivers/md/dm-integrity.c +@@ -4112,16 +4112,19 @@ try_smaller_buffer: + + ic->recalc_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages); + if (!ic->recalc_bitmap) { ++ ti->error = "Could not allocate memory for bitmap"; + r = -ENOMEM; + goto bad; + } + ic->may_write_bitmap = dm_integrity_alloc_page_list(n_bitmap_pages); + if (!ic->may_write_bitmap) { ++ ti->error = "Could not allocate memory for bitmap"; + r = -ENOMEM; + goto bad; + } + ic->bbs = kvmalloc_array(ic->n_bitmap_blocks, sizeof(struct bitmap_block_status), GFP_KERNEL); + if (!ic->bbs) { ++ ti->error = "Could not allocate memory for bitmap"; + r = -ENOMEM; + goto bad; + } diff --git a/queue-5.4/ftrace-add-cond_resched-to-ftrace_graph_set_hash.patch b/queue-5.4/ftrace-add-cond_resched-to-ftrace_graph_set_hash.patch new file mode 100644 index 0000000000..5dfdc3fdf4 --- /dev/null +++ b/queue-5.4/ftrace-add-cond_resched-to-ftrace_graph_set_hash.patch @@ -0,0 +1,39 @@ +From 42ea22e754ba4f2b86f8760ca27f6f71da2d982c Mon Sep 17 00:00:00 2001 +From: zhoumin +Date: Tue, 1 Apr 2025 01:00:34 +0800 +Subject: ftrace: Add cond_resched() to ftrace_graph_set_hash() + +From: zhoumin + +commit 42ea22e754ba4f2b86f8760ca27f6f71da2d982c upstream. + +When the kernel contains a large number of functions that can be traced, +the loop in ftrace_graph_set_hash() may take a lot of time to execute. +This may trigger the softlockup watchdog. + +Add cond_resched() within the loop to allow the kernel to remain +responsive even when processing a large number of functions. + +This matches the cond_resched() that is used in other locations of the +code that iterates over all functions that can be traced. + +Cc: stable@vger.kernel.org +Fixes: b9b0c831bed26 ("ftrace: Convert graph filter to use hash tables") +Link: https://lore.kernel.org/tencent_3E06CE338692017B5809534B9C5C03DA7705@qq.com +Signed-off-by: zhoumin +Signed-off-by: Steven Rostedt (Google) +Signed-off-by: Greg Kroah-Hartman +--- + kernel/trace/ftrace.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/kernel/trace/ftrace.c ++++ b/kernel/trace/ftrace.c +@@ -5506,6 +5506,7 @@ ftrace_graph_set_hash(struct ftrace_hash + } + } + } ++ cond_resched(); + } while_for_each_ftrace_rec(); + out: + mutex_unlock(&ftrace_lock); diff --git a/queue-5.4/gpio-zynq-fix-wakeup-source-leaks-on-device-unbind.patch b/queue-5.4/gpio-zynq-fix-wakeup-source-leaks-on-device-unbind.patch new file mode 100644 index 0000000000..7e101fb4b9 --- /dev/null +++ b/queue-5.4/gpio-zynq-fix-wakeup-source-leaks-on-device-unbind.patch @@ -0,0 +1,31 @@ +From c5672e310ad971d408752fce7596ed27adc6008f Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Sun, 6 Apr 2025 22:22:45 +0200 +Subject: gpio: zynq: Fix wakeup source leaks on device unbind + +From: Krzysztof Kozlowski + +commit c5672e310ad971d408752fce7596ed27adc6008f upstream. + +Device can be unbound, so driver must also release memory for the wakeup +source. + +Cc: stable@vger.kernel.org +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20250406202245.53854-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpio/gpio-zynq.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/gpio/gpio-zynq.c ++++ b/drivers/gpio/gpio-zynq.c +@@ -943,6 +943,7 @@ static int zynq_gpio_remove(struct platf + ret = pm_runtime_get_sync(&pdev->dev); + if (ret < 0) + dev_warn(&pdev->dev, "pm_runtime_get_sync() Failed\n"); ++ device_init_wakeup(&pdev->dev, 0); + gpiochip_remove(&gpio->chip); + clk_disable_unprepare(gpio->clk); + device_set_wakeup_capable(&pdev->dev, 0); diff --git a/queue-5.4/series b/queue-5.4/series index 0e1e77d8a3..e3c0c18cbe 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -66,3 +66,8 @@ arm64-dts-mediatek-mt8173-fix-disp-pwm-compatible-string.patch sparc-mm-disable-preemption-in-lazy-mmu-mode.patch mm-add-missing-release-barrier-on-pgdat_reclaim_locked-unlock.patch sctp-detect-and-prevent-references-to-a-freed-transport-in-sendmsg.patch +thermal-drivers-rockchip-add-missing-rk3328-mapping-entry.patch +crypto-ccp-fix-check-for-the-primary-asp-device.patch +dm-integrity-set-ti-error-on-memory-allocation-failure.patch +ftrace-add-cond_resched-to-ftrace_graph_set_hash.patch +gpio-zynq-fix-wakeup-source-leaks-on-device-unbind.patch diff --git a/queue-5.4/thermal-drivers-rockchip-add-missing-rk3328-mapping-entry.patch b/queue-5.4/thermal-drivers-rockchip-add-missing-rk3328-mapping-entry.patch new file mode 100644 index 0000000000..ced101cf44 --- /dev/null +++ b/queue-5.4/thermal-drivers-rockchip-add-missing-rk3328-mapping-entry.patch @@ -0,0 +1,61 @@ +From ee022e5cae052e0c67ca7c5fec0f2e7bc897c70e Mon Sep 17 00:00:00 2001 +From: Trevor Woerner +Date: Fri, 7 Feb 2025 12:50:47 -0500 +Subject: thermal/drivers/rockchip: Add missing rk3328 mapping entry + +From: Trevor Woerner + +commit ee022e5cae052e0c67ca7c5fec0f2e7bc897c70e upstream. + +The mapping table for the rk3328 is missing the entry for -25C which is +found in the TRM section 9.5.2 "Temperature-to-code mapping". + +NOTE: the kernel uses the tsadc_q_sel=1'b1 mode which is defined as: + 4096-. Whereas the table in the TRM gives the code + "3774" for -25C, the kernel uses 4096-3774=322. + +[Dragan Simic] : "After going through the RK3308 and RK3328 TRMs, as + well as through the downstream kernel code, it seems we may have + some troubles at our hands. Let me explain, please. + + To sum it up, part 1 of the RK3308 TRM v1.1 says on page 538 that + the equation for the output when tsadc_q_sel equals 1 is (4096 - + tsadc_q), while part 1 of the RK3328 TRM v1.2 says that the output + equation is (1024 - tsadc_q) in that case. + + The downstream kernel code, however, treats the RK3308 and RK3328 + tables and their values as being the same. It even mentions 1024 as + the "offset" value in a comment block for the rk_tsadcv3_control() + function, just like the upstream code does, which is obviously wrong + "offset" value when correlated with the table on page 544 of part 1 + of the RK3308 TRM v1.1. + + With all this in mind, it's obvious that more work is needed to make + it clear where's the actual mistake (it could be that the TRM is + wrong), which I'll volunteer for as part of the SoC binning project. + In the meantime, this patch looks fine as-is to me, by offering + what's a clear improvement to the current state of the upstream + code" + +Link: https://opensource.rock-chips.com/images/9/97/Rockchip_RK3328TRM_V1.1-Part1-20170321.pdf +Cc: stable@vger.kernel.org +Fixes: eda519d5f73e ("thermal: rockchip: Support the RK3328 SOC in thermal driver") +Signed-off-by: Trevor Woerner +Reviewed-by: Dragan Simic +Link: https://lore.kernel.org/r/20250207175048.35959-1-twoerner@gmail.com +Signed-off-by: Daniel Lezcano +Signed-off-by: Greg Kroah-Hartman +--- + drivers/thermal/rockchip_thermal.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/thermal/rockchip_thermal.c ++++ b/drivers/thermal/rockchip_thermal.c +@@ -360,6 +360,7 @@ static const struct tsadc_table rk3328_c + {296, -40000}, + {304, -35000}, + {313, -30000}, ++ {322, -25000}, + {331, -20000}, + {340, -15000}, + {349, -10000},