From: Greg Kroah-Hartman Date: Mon, 20 Mar 2023 10:02:58 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v4.14.311~40 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3c0c584e4368e4bc4d4ab57e9cf24bb7863d7d35;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: firmware-xilinx-don-t-make-a-sleepable-memory-allocation-from-an-atomic-context.patch interconnect-exynos-fix-node-leak-in-probe-pm-qos-error-path.patch interconnect-fix-mem-leak-when-freeing-nodes.patch s390-ipl-add-missing-intersection-check-to-ipl_report-handling.patch serial-qcom-geni-fix-console-shutdown-hang.patch --- diff --git a/queue-5.15/firmware-xilinx-don-t-make-a-sleepable-memory-allocation-from-an-atomic-context.patch b/queue-5.15/firmware-xilinx-don-t-make-a-sleepable-memory-allocation-from-an-atomic-context.patch new file mode 100644 index 00000000000..3c67c1ce8bd --- /dev/null +++ b/queue-5.15/firmware-xilinx-don-t-make-a-sleepable-memory-allocation-from-an-atomic-context.patch @@ -0,0 +1,89 @@ +From 38ed310c22e7a0fc978b1f8292136a4a4a8b3051 Mon Sep 17 00:00:00 2001 +From: Roman Gushchin +Date: Wed, 8 Mar 2023 14:26:02 -0800 +Subject: firmware: xilinx: don't make a sleepable memory allocation from an atomic context + +From: Roman Gushchin + +commit 38ed310c22e7a0fc978b1f8292136a4a4a8b3051 upstream. + +The following issue was discovered using lockdep: +[ 6.691371] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:209 +[ 6.694602] in_atomic(): 1, irqs_disabled(): 128, non_block: 0, pid: 1, name: swapper/0 +[ 6.702431] 2 locks held by swapper/0/1: +[ 6.706300] #0: ffffff8800f6f188 (&dev->mutex){....}-{3:3}, at: __device_driver_lock+0x4c/0x90 +[ 6.714900] #1: ffffffc009a2abb8 (enable_lock){....}-{2:2}, at: clk_enable_lock+0x4c/0x140 +[ 6.723156] irq event stamp: 304030 +[ 6.726596] hardirqs last enabled at (304029): [] _raw_spin_unlock_irqrestore+0xc0/0xd0 +[ 6.736142] hardirqs last disabled at (304030): [] clk_enable_lock+0xfc/0x140 +[ 6.744742] softirqs last enabled at (303958): [] _stext+0x4f0/0x894 +[ 6.752655] softirqs last disabled at (303951): [] irq_exit+0x238/0x280 +[ 6.760744] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G U 5.15.36 #2 +[ 6.768048] Hardware name: xlnx,zynqmp (DT) +[ 6.772179] Call trace: +[ 6.774584] dump_backtrace+0x0/0x300 +[ 6.778197] show_stack+0x18/0x30 +[ 6.781465] dump_stack_lvl+0xb8/0xec +[ 6.785077] dump_stack+0x1c/0x38 +[ 6.788345] ___might_sleep+0x1a8/0x2a0 +[ 6.792129] __might_sleep+0x6c/0xd0 +[ 6.795655] kmem_cache_alloc_trace+0x270/0x3d0 +[ 6.800127] do_feature_check_call+0x100/0x220 +[ 6.804513] zynqmp_pm_invoke_fn+0x8c/0xb0 +[ 6.808555] zynqmp_pm_clock_getstate+0x90/0xe0 +[ 6.813027] zynqmp_pll_is_enabled+0x8c/0x120 +[ 6.817327] zynqmp_pll_enable+0x38/0xc0 +[ 6.821197] clk_core_enable+0x144/0x400 +[ 6.825067] clk_core_enable+0xd4/0x400 +[ 6.828851] clk_core_enable+0xd4/0x400 +[ 6.832635] clk_core_enable+0xd4/0x400 +[ 6.836419] clk_core_enable+0xd4/0x400 +[ 6.840203] clk_core_enable+0xd4/0x400 +[ 6.843987] clk_core_enable+0xd4/0x400 +[ 6.847771] clk_core_enable+0xd4/0x400 +[ 6.851555] clk_core_enable_lock+0x24/0x50 +[ 6.855683] clk_enable+0x24/0x40 +[ 6.858952] fclk_probe+0x84/0xf0 +[ 6.862220] platform_probe+0x8c/0x110 +[ 6.865918] really_probe+0x110/0x5f0 +[ 6.869530] __driver_probe_device+0xcc/0x210 +[ 6.873830] driver_probe_device+0x64/0x140 +[ 6.877958] __driver_attach+0x114/0x1f0 +[ 6.881828] bus_for_each_dev+0xe8/0x160 +[ 6.885698] driver_attach+0x34/0x50 +[ 6.889224] bus_add_driver+0x228/0x300 +[ 6.893008] driver_register+0xc0/0x1e0 +[ 6.896792] __platform_driver_register+0x44/0x60 +[ 6.901436] fclk_driver_init+0x1c/0x28 +[ 6.905220] do_one_initcall+0x104/0x590 +[ 6.909091] kernel_init_freeable+0x254/0x2bc +[ 6.913390] kernel_init+0x24/0x130 +[ 6.916831] ret_from_fork+0x10/0x20 + +Fix it by passing the GFP_ATOMIC gfp flag for the corresponding +memory allocation. + +Fixes: acfdd18591ea ("firmware: xilinx: Use hash-table for api feature check") +Cc: stable +Signed-off-by: Roman Gushchin +Cc: Amit Sunil Dhamne +Cc: Michal Simek +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-kernel@vger.kernel.org +Link: https://lore.kernel.org/r/20230308222602.123866-1-roman.gushchin@linux.dev +Signed-off-by: Greg Kroah-Hartman +--- + drivers/firmware/xilinx/zynqmp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/firmware/xilinx/zynqmp.c ++++ b/drivers/firmware/xilinx/zynqmp.c +@@ -171,7 +171,7 @@ static int zynqmp_pm_feature(u32 api_id) + } + + /* Add new entry if not present */ +- feature_data = kmalloc(sizeof(*feature_data), GFP_KERNEL); ++ feature_data = kmalloc(sizeof(*feature_data), GFP_ATOMIC); + if (!feature_data) + return -ENOMEM; + diff --git a/queue-5.15/interconnect-exynos-fix-node-leak-in-probe-pm-qos-error-path.patch b/queue-5.15/interconnect-exynos-fix-node-leak-in-probe-pm-qos-error-path.patch new file mode 100644 index 00000000000..80a7c151f0f --- /dev/null +++ b/queue-5.15/interconnect-exynos-fix-node-leak-in-probe-pm-qos-error-path.patch @@ -0,0 +1,46 @@ +From 3aab264875bf3c915ea2517fae1eec213e0b4987 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 6 Mar 2023 08:56:42 +0100 +Subject: interconnect: exynos: fix node leak in probe PM QoS error path + +From: Johan Hovold + +commit 3aab264875bf3c915ea2517fae1eec213e0b4987 upstream. + +Make sure to add the newly allocated interconnect node to the provider +before adding the PM QoS request so that the node is freed on errors. + +Fixes: 2f95b9d5cf0b ("interconnect: Add generic interconnect driver for Exynos SoCs") +Cc: stable@vger.kernel.org # 5.11 +Cc: Sylwester Nawrocki +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20230306075651.2449-15-johan+linaro@kernel.org +Signed-off-by: Georgi Djakov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/interconnect/samsung/exynos.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/interconnect/samsung/exynos.c ++++ b/drivers/interconnect/samsung/exynos.c +@@ -149,6 +149,9 @@ static int exynos_generic_icc_probe(stru + &priv->bus_clk_ratio)) + priv->bus_clk_ratio = EXYNOS_ICC_DEFAULT_BUS_CLK_RATIO; + ++ icc_node->data = priv; ++ icc_node_add(icc_node, provider); ++ + /* + * Register a PM QoS request for the parent (devfreq) device. + */ +@@ -157,9 +160,6 @@ static int exynos_generic_icc_probe(stru + if (ret < 0) + goto err_node_del; + +- icc_node->data = priv; +- icc_node_add(icc_node, provider); +- + icc_parent_node = exynos_icc_get_parent(bus_dev->of_node); + if (IS_ERR(icc_parent_node)) { + ret = PTR_ERR(icc_parent_node); diff --git a/queue-5.15/interconnect-fix-mem-leak-when-freeing-nodes.patch b/queue-5.15/interconnect-fix-mem-leak-when-freeing-nodes.patch new file mode 100644 index 00000000000..82ae96f112e --- /dev/null +++ b/queue-5.15/interconnect-fix-mem-leak-when-freeing-nodes.patch @@ -0,0 +1,37 @@ +From a5904f415e1af72fa8fe6665aa4f554dc2099a95 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 6 Mar 2023 08:56:29 +0100 +Subject: interconnect: fix mem leak when freeing nodes + +From: Johan Hovold + +commit a5904f415e1af72fa8fe6665aa4f554dc2099a95 upstream. + +The node link array is allocated when adding links to a node but is not +deallocated when nodes are destroyed. + +Fixes: 11f1ceca7031 ("interconnect: Add generic on-chip interconnect API") +Cc: stable@vger.kernel.org # 5.1 +Reviewed-by: Konrad Dybcio +Signed-off-by: Johan Hovold +Tested-by: Luca Ceresoli # i.MX8MP MSC SM2-MB-EP1 Board +Link: https://lore.kernel.org/r/20230306075651.2449-2-johan+linaro@kernel.org +Signed-off-by: Georgi Djakov +Signed-off-by: Greg Kroah-Hartman +--- + drivers/interconnect/core.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/interconnect/core.c ++++ b/drivers/interconnect/core.c +@@ -850,6 +850,10 @@ void icc_node_destroy(int id) + + mutex_unlock(&icc_lock); + ++ if (!node) ++ return; ++ ++ kfree(node->links); + kfree(node); + } + EXPORT_SYMBOL_GPL(icc_node_destroy); diff --git a/queue-5.15/s390-ipl-add-missing-intersection-check-to-ipl_report-handling.patch b/queue-5.15/s390-ipl-add-missing-intersection-check-to-ipl_report-handling.patch new file mode 100644 index 00000000000..dc1dc9984f5 --- /dev/null +++ b/queue-5.15/s390-ipl-add-missing-intersection-check-to-ipl_report-handling.patch @@ -0,0 +1,50 @@ +From a52e5cdbe8016d4e3e6322fd93d71afddb9a5af9 Mon Sep 17 00:00:00 2001 +From: Sven Schnelle +Date: Tue, 7 Mar 2023 14:35:23 +0100 +Subject: s390/ipl: add missing intersection check to ipl_report handling + +From: Sven Schnelle + +commit a52e5cdbe8016d4e3e6322fd93d71afddb9a5af9 upstream. + +The code which handles the ipl report is searching for a free location +in memory where it could copy the component and certificate entries to. +It checks for intersection between the sections required for the kernel +and the component/certificate data area, but fails to check whether +the data structures linking these data areas together intersect. + +This might cause the iplreport copy code to overwrite the iplreport +itself. Fix this by adding two addtional intersection checks. + +Cc: +Fixes: 9641b8cc733f ("s390/ipl: read IPL report at early boot") +Signed-off-by: Sven Schnelle +Reviewed-by: Vasily Gorbik +Signed-off-by: Vasily Gorbik +Signed-off-by: Greg Kroah-Hartman +--- + arch/s390/boot/ipl_report.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +--- a/arch/s390/boot/ipl_report.c ++++ b/arch/s390/boot/ipl_report.c +@@ -57,11 +57,19 @@ repeat: + if (IS_ENABLED(CONFIG_BLK_DEV_INITRD) && initrd_data.start && initrd_data.size && + intersects(initrd_data.start, initrd_data.size, safe_addr, size)) + safe_addr = initrd_data.start + initrd_data.size; ++ if (intersects(safe_addr, size, (unsigned long)comps, comps->len)) { ++ safe_addr = (unsigned long)comps + comps->len; ++ goto repeat; ++ } + for_each_rb_entry(comp, comps) + if (intersects(safe_addr, size, comp->addr, comp->len)) { + safe_addr = comp->addr + comp->len; + goto repeat; + } ++ if (intersects(safe_addr, size, (unsigned long)certs, certs->len)) { ++ safe_addr = (unsigned long)certs + certs->len; ++ goto repeat; ++ } + for_each_rb_entry(cert, certs) + if (intersects(safe_addr, size, cert->addr, cert->len)) { + safe_addr = cert->addr + cert->len; diff --git a/queue-5.15/serial-qcom-geni-fix-console-shutdown-hang.patch b/queue-5.15/serial-qcom-geni-fix-console-shutdown-hang.patch new file mode 100644 index 00000000000..3f6f9b2587d --- /dev/null +++ b/queue-5.15/serial-qcom-geni-fix-console-shutdown-hang.patch @@ -0,0 +1,49 @@ +From 9aff74cc4e9eb841dde5fd009ed7ddca5db40e68 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 7 Mar 2023 17:44:02 +0100 +Subject: serial: qcom-geni: fix console shutdown hang + +From: Johan Hovold + +commit 9aff74cc4e9eb841dde5fd009ed7ddca5db40e68 upstream. + +A recent commit added back the calls top stop tx and rx to shutdown() +which had previously been removed by commit e83766334f96 ("tty: serial: +qcom_geni_serial: No need to stop tx/rx on UART shutdown") in order to +be able to use kgdb after stopping the getty. + +Not only did this again break kgdb, but it also broke serial consoles +more generally by hanging TX when stopping the getty during reboot. + +The underlying problem has been there since the driver was first merged +and fixing it is going to be a bit involved so simply stop calling the +broken stop functions during shutdown for consoles for now. + +Fixes: d8aca2f96813 ("tty: serial: qcom-geni-serial: stop operations in progress at shutdown") +Cc: stable +Cc: Bartosz Golaszewski +Signed-off-by: Johan Hovold +Reviewed-by: Douglas Anderson +Reviewed-by: Srinivas Kandagatla +Tested-by: Srinivas Kandagatla +Reviewed-by: Andrew Halaney +Tested-by: Andrew Halaney # sa8540p-ride +Link: https://lore.kernel.org/r/20230307164405.14218-2-johan+linaro@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/qcom_geni_serial.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/tty/serial/qcom_geni_serial.c ++++ b/drivers/tty/serial/qcom_geni_serial.c +@@ -893,6 +893,10 @@ static int setup_fifos(struct qcom_geni_ + static void qcom_geni_serial_shutdown(struct uart_port *uport) + { + disable_irq(uport->irq); ++ ++ if (uart_console(uport)) ++ return; ++ + qcom_geni_serial_stop_tx(uport); + qcom_geni_serial_stop_rx(uport); + } diff --git a/queue-5.15/series b/queue-5.15/series index 2e3dbc8d6fc..9873f97222d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -75,3 +75,8 @@ tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-i serial-8250_em-fix-uart-port-type.patch serial-8250_fsl-fix-handle_irq-locking.patch tty-serial-qcom-geni-serial-stop-operations-in-progress-at-shutdown.patch +serial-qcom-geni-fix-console-shutdown-hang.patch +firmware-xilinx-don-t-make-a-sleepable-memory-allocation-from-an-atomic-context.patch +s390-ipl-add-missing-intersection-check-to-ipl_report-handling.patch +interconnect-fix-mem-leak-when-freeing-nodes.patch +interconnect-exynos-fix-node-leak-in-probe-pm-qos-error-path.patch