From: Sasha Levin Date: Fri, 11 Oct 2024 19:35:13 +0000 (-0400) Subject: Fixes for 6.1 X-Git-Tag: v5.10.227~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=819cb989d7205097e239db1d3e6545bd69a3f629;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.1 Signed-off-by: Sasha Levin --- diff --git a/queue-6.1/bpf-check-percpu-map-value-size-first.patch b/queue-6.1/bpf-check-percpu-map-value-size-first.patch new file mode 100644 index 00000000000..79dcb992a57 --- /dev/null +++ b/queue-6.1/bpf-check-percpu-map-value-size-first.patch @@ -0,0 +1,59 @@ +From 329049a9604ee18807c3c5fd181b7fc9555329d0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Sep 2024 22:41:10 +0800 +Subject: bpf: Check percpu map value size first + +From: Tao Chen + +[ Upstream commit 1d244784be6b01162b732a5a7d637dfc024c3203 ] + +Percpu map is often used, but the map value size limit often ignored, +like issue: https://github.com/iovisor/bcc/issues/2519. Actually, +percpu map value size is bound by PCPU_MIN_UNIT_SIZE, so we +can check the value size whether it exceeds PCPU_MIN_UNIT_SIZE first, +like percpu map of local_storage. Maybe the error message seems clearer +compared with "cannot allocate memory". + +Signed-off-by: Jinke Han +Signed-off-by: Tao Chen +Signed-off-by: Andrii Nakryiko +Acked-by: Jiri Olsa +Acked-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20240910144111.1464912-2-chen.dylane@gmail.com +Signed-off-by: Sasha Levin +--- + kernel/bpf/arraymap.c | 3 +++ + kernel/bpf/hashtab.c | 3 +++ + 2 files changed, 6 insertions(+) + +diff --git a/kernel/bpf/arraymap.c b/kernel/bpf/arraymap.c +index c04e69f34e4d5..50b9bf57a4e3e 100644 +--- a/kernel/bpf/arraymap.c ++++ b/kernel/bpf/arraymap.c +@@ -73,6 +73,9 @@ int array_map_alloc_check(union bpf_attr *attr) + /* avoid overflow on round_up(map->value_size) */ + if (attr->value_size > INT_MAX) + return -E2BIG; ++ /* percpu map value size is bound by PCPU_MIN_UNIT_SIZE */ ++ if (percpu && round_up(attr->value_size, 8) > PCPU_MIN_UNIT_SIZE) ++ return -E2BIG; + + return 0; + } +diff --git a/kernel/bpf/hashtab.c b/kernel/bpf/hashtab.c +index 0c74cc9012d5c..dae9ed02a75be 100644 +--- a/kernel/bpf/hashtab.c ++++ b/kernel/bpf/hashtab.c +@@ -455,6 +455,9 @@ static int htab_map_alloc_check(union bpf_attr *attr) + * kmalloc-able later in htab_map_update_elem() + */ + return -E2BIG; ++ /* percpu map value size is bound by PCPU_MIN_UNIT_SIZE */ ++ if (percpu && round_up(attr->value_size, 8) > PCPU_MIN_UNIT_SIZE) ++ return -E2BIG; + + return 0; + } +-- +2.43.0 + diff --git a/queue-6.1/bpf-x64-fix-a-jit-convergence-issue.patch b/queue-6.1/bpf-x64-fix-a-jit-convergence-issue.patch new file mode 100644 index 00000000000..efe41c45eee --- /dev/null +++ b/queue-6.1/bpf-x64-fix-a-jit-convergence-issue.patch @@ -0,0 +1,186 @@ +From c288bcac872c9a70dc1d846a4ba9bc76f52d265e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Sep 2024 15:12:51 -0700 +Subject: bpf, x64: Fix a jit convergence issue + +From: Yonghong Song + +[ Upstream commit c8831bdbfbab672c006a18006d36932a494b2fd6 ] + +Daniel Hodges reported a jit error when playing with a sched-ext program. +The error message is: + unexpected jmp_cond padding: -4 bytes + +But further investigation shows the error is actual due to failed +convergence. The following are some analysis: + + ... + pass4, final_proglen=4391: + ... + 20e: 48 85 ff test rdi,rdi + 211: 74 7d je 0x290 + 213: 48 8b 77 00 mov rsi,QWORD PTR [rdi+0x0] + ... + 289: 48 85 ff test rdi,rdi + 28c: 74 17 je 0x2a5 + 28e: e9 7f ff ff ff jmp 0x212 + 293: bf 03 00 00 00 mov edi,0x3 + +Note that insn at 0x211 is 2-byte cond jump insn for offset 0x7d (-125) +and insn at 0x28e is 5-byte jmp insn with offset -129. + + pass5, final_proglen=4392: + ... + 20e: 48 85 ff test rdi,rdi + 211: 0f 84 80 00 00 00 je 0x297 + 217: 48 8b 77 00 mov rsi,QWORD PTR [rdi+0x0] + ... + 28d: 48 85 ff test rdi,rdi + 290: 74 1a je 0x2ac + 292: eb 84 jmp 0x218 + 294: bf 03 00 00 00 mov edi,0x3 + +Note that insn at 0x211 is 6-byte cond jump insn now since its offset +becomes 0x80 based on previous round (0x293 - 0x213 = 0x80). At the same +time, insn at 0x292 is a 2-byte insn since its offset is -124. + +pass6 will repeat the same code as in pass4. pass7 will repeat the same +code as in pass5, and so on. This will prevent eventual convergence. + +Passes 1-14 are with padding = 0. At pass15, padding is 1 and related +insn looks like: + + 211: 0f 84 80 00 00 00 je 0x297 + 217: 48 8b 77 00 mov rsi,QWORD PTR [rdi+0x0] + ... + 24d: 48 85 d2 test rdx,rdx + +The similar code in pass14: + 211: 74 7d je 0x290 + 213: 48 8b 77 00 mov rsi,QWORD PTR [rdi+0x0] + ... + 249: 48 85 d2 test rdx,rdx + 24c: 74 21 je 0x26f + 24e: 48 01 f7 add rdi,rsi + ... + +Before generating the following insn, + 250: 74 21 je 0x273 +"padding = 1" enables some checking to ensure nops is either 0 or 4 +where + #define INSN_SZ_DIFF (((addrs[i] - addrs[i - 1]) - (prog - temp))) + nops = INSN_SZ_DIFF - 2 + +In this specific case, + addrs[i] = 0x24e // from pass14 + addrs[i-1] = 0x24d // from pass15 + prog - temp = 3 // from 'test rdx,rdx' in pass15 +so + nops = -4 +and this triggers the failure. + +To fix the issue, we need to break cycles of je <-> jmp. For example, +in the above case, we have + 211: 74 7d je 0x290 +the offset is 0x7d. If 2-byte je insn is generated only if +the offset is less than 0x7d (<= 0x7c), the cycle can be +break and we can achieve the convergence. + +I did some study on other cases like je <-> je, jmp <-> je and +jmp <-> jmp which may cause cycles. Those cases are not from actual +reproducible cases since it is pretty hard to construct a test case +for them. the results show that the offset <= 0x7b (0x7b = 123) should +be enough to cover all cases. This patch added a new helper to generate 8-bit +cond/uncond jmp insns only if the offset range is [-128, 123]. + +Reported-by: Daniel Hodges +Signed-off-by: Yonghong Song +Link: https://lore.kernel.org/r/20240904221251.37109-1-yonghong.song@linux.dev +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + arch/x86/net/bpf_jit_comp.c | 54 +++++++++++++++++++++++++++++++++++-- + 1 file changed, 52 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c +index 7913440c0fd46..92db785a0a8eb 100644 +--- a/arch/x86/net/bpf_jit_comp.c ++++ b/arch/x86/net/bpf_jit_comp.c +@@ -57,6 +57,56 @@ static bool is_imm8(int value) + return value <= 127 && value >= -128; + } + ++/* ++ * Let us limit the positive offset to be <= 123. ++ * This is to ensure eventual jit convergence For the following patterns: ++ * ... ++ * pass4, final_proglen=4391: ++ * ... ++ * 20e: 48 85 ff test rdi,rdi ++ * 211: 74 7d je 0x290 ++ * 213: 48 8b 77 00 mov rsi,QWORD PTR [rdi+0x0] ++ * ... ++ * 289: 48 85 ff test rdi,rdi ++ * 28c: 74 17 je 0x2a5 ++ * 28e: e9 7f ff ff ff jmp 0x212 ++ * 293: bf 03 00 00 00 mov edi,0x3 ++ * Note that insn at 0x211 is 2-byte cond jump insn for offset 0x7d (-125) ++ * and insn at 0x28e is 5-byte jmp insn with offset -129. ++ * ++ * pass5, final_proglen=4392: ++ * ... ++ * 20e: 48 85 ff test rdi,rdi ++ * 211: 0f 84 80 00 00 00 je 0x297 ++ * 217: 48 8b 77 00 mov rsi,QWORD PTR [rdi+0x0] ++ * ... ++ * 28d: 48 85 ff test rdi,rdi ++ * 290: 74 1a je 0x2ac ++ * 292: eb 84 jmp 0x218 ++ * 294: bf 03 00 00 00 mov edi,0x3 ++ * Note that insn at 0x211 is 6-byte cond jump insn now since its offset ++ * becomes 0x80 based on previous round (0x293 - 0x213 = 0x80). ++ * At the same time, insn at 0x292 is a 2-byte insn since its offset is ++ * -124. ++ * ++ * pass6 will repeat the same code as in pass4 and this will prevent ++ * eventual convergence. ++ * ++ * To fix this issue, we need to break je (2->6 bytes) <-> jmp (5->2 bytes) ++ * cycle in the above. In the above example je offset <= 0x7c should work. ++ * ++ * For other cases, je <-> je needs offset <= 0x7b to avoid no convergence ++ * issue. For jmp <-> je and jmp <-> jmp cases, jmp offset <= 0x7c should ++ * avoid no convergence issue. ++ * ++ * Overall, let us limit the positive offset for 8bit cond/uncond jmp insn ++ * to maximum 123 (0x7b). This way, the jit pass can eventually converge. ++ */ ++static bool is_imm8_jmp_offset(int value) ++{ ++ return value <= 123 && value >= -128; ++} ++ + static bool is_simm32(s64 value) + { + return value == (s64)(s32)value; +@@ -1589,7 +1639,7 @@ st: if (is_imm8(insn->off)) + return -EFAULT; + } + jmp_offset = addrs[i + insn->off] - addrs[i]; +- if (is_imm8(jmp_offset)) { ++ if (is_imm8_jmp_offset(jmp_offset)) { + if (jmp_padding) { + /* To keep the jmp_offset valid, the extra bytes are + * padded before the jump insn, so we subtract the +@@ -1671,7 +1721,7 @@ st: if (is_imm8(insn->off)) + break; + } + emit_jmp: +- if (is_imm8(jmp_offset)) { ++ if (is_imm8_jmp_offset(jmp_offset)) { + if (jmp_padding) { + /* To avoid breaking jmp_offset, the extra bytes + * are padded before the actual jmp insn, so +-- +2.43.0 + diff --git a/queue-6.1/clk-bcm-bcm53573-fix-of-node-leak-in-init.patch b/queue-6.1/clk-bcm-bcm53573-fix-of-node-leak-in-init.patch new file mode 100644 index 00000000000..bb92b8d0c8d --- /dev/null +++ b/queue-6.1/clk-bcm-bcm53573-fix-of-node-leak-in-init.patch @@ -0,0 +1,39 @@ +From e7fc5a797b3bc0bfc10ba36a880a16c8654ee9c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Aug 2024 08:58:01 +0200 +Subject: clk: bcm: bcm53573: fix OF node leak in init + +From: Krzysztof Kozlowski + +[ Upstream commit f92d67e23b8caa81f6322a2bad1d633b00ca000e ] + +Driver code is leaking OF node reference from of_get_parent() in +bcm53573_ilp_init(). Usage of of_get_parent() is not needed in the +first place, because the parent node will not be freed while we are +processing given node (triggered by CLK_OF_DECLARE()). Thus fix the +leak by accessing parent directly, instead of of_get_parent(). + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20240826065801.17081-1-krzysztof.kozlowski@linaro.org +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/bcm/clk-bcm53573-ilp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/bcm/clk-bcm53573-ilp.c b/drivers/clk/bcm/clk-bcm53573-ilp.c +index 84f2af736ee8a..83ef41d618be3 100644 +--- a/drivers/clk/bcm/clk-bcm53573-ilp.c ++++ b/drivers/clk/bcm/clk-bcm53573-ilp.c +@@ -112,7 +112,7 @@ static void bcm53573_ilp_init(struct device_node *np) + goto err_free_ilp; + } + +- ilp->regmap = syscon_node_to_regmap(of_get_parent(np)); ++ ilp->regmap = syscon_node_to_regmap(np->parent); + if (IS_ERR(ilp->regmap)) { + err = PTR_ERR(ilp->regmap); + goto err_free_ilp; +-- +2.43.0 + diff --git a/queue-6.1/clk-imx-remove-clk_set_parent_gate-for-dram-mux-for-.patch b/queue-6.1/clk-imx-remove-clk_set_parent_gate-for-dram-mux-for-.patch new file mode 100644 index 00000000000..978554f7ff9 --- /dev/null +++ b/queue-6.1/clk-imx-remove-clk_set_parent_gate-for-dram-mux-for-.patch @@ -0,0 +1,44 @@ +From 0875716b0cd23769af8ef41d072ba115bec2d2fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 7 Jun 2024 21:33:39 +0800 +Subject: clk: imx: Remove CLK_SET_PARENT_GATE for DRAM mux for i.MX7D + +From: Peng Fan + +[ Upstream commit a54c441b46a0745683c2eef5a359d22856d27323 ] + +For i.MX7D DRAM related mux clock, the clock source change should ONLY +be done done in low level asm code without accessing DRAM, and then +calling clk API to sync the HW clock status with clk tree, it should never +touch real clock source switch via clk API, so CLK_SET_PARENT_GATE flag +should NOT be added, otherwise, DRAM's clock parent will be disabled when +DRAM is active, and system will hang. + +Signed-off-by: Peng Fan +Reviewed-by: Abel Vesa +Link: https://lore.kernel.org/r/20240607133347.3291040-8-peng.fan@oss.nxp.com +Signed-off-by: Abel Vesa +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx7d.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c +index cbf8131c63f7e..f26b85e8f3292 100644 +--- a/drivers/clk/imx/clk-imx7d.c ++++ b/drivers/clk/imx/clk-imx7d.c +@@ -498,9 +498,9 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) + hws[IMX7D_ENET_AXI_ROOT_SRC] = imx_clk_hw_mux2_flags("enet_axi_src", base + 0x8900, 24, 3, enet_axi_sel, ARRAY_SIZE(enet_axi_sel), CLK_SET_PARENT_GATE); + hws[IMX7D_NAND_USDHC_BUS_ROOT_SRC] = imx_clk_hw_mux2_flags("nand_usdhc_src", base + 0x8980, 24, 3, nand_usdhc_bus_sel, ARRAY_SIZE(nand_usdhc_bus_sel), CLK_SET_PARENT_GATE); + hws[IMX7D_DRAM_PHYM_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_phym_src", base + 0x9800, 24, 1, dram_phym_sel, ARRAY_SIZE(dram_phym_sel), CLK_SET_PARENT_GATE); +- hws[IMX7D_DRAM_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel), CLK_SET_PARENT_GATE); ++ hws[IMX7D_DRAM_ROOT_SRC] = imx_clk_hw_mux2("dram_src", base + 0x9880, 24, 1, dram_sel, ARRAY_SIZE(dram_sel)); + hws[IMX7D_DRAM_PHYM_ALT_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_phym_alt_src", base + 0xa000, 24, 3, dram_phym_alt_sel, ARRAY_SIZE(dram_phym_alt_sel), CLK_SET_PARENT_GATE); +- hws[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_hw_mux2_flags("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel), CLK_SET_PARENT_GATE); ++ hws[IMX7D_DRAM_ALT_ROOT_SRC] = imx_clk_hw_mux2("dram_alt_src", base + 0xa080, 24, 3, dram_alt_sel, ARRAY_SIZE(dram_alt_sel)); + hws[IMX7D_USB_HSIC_ROOT_SRC] = imx_clk_hw_mux2_flags("usb_hsic_src", base + 0xa100, 24, 3, usb_hsic_sel, ARRAY_SIZE(usb_hsic_sel), CLK_SET_PARENT_GATE); + hws[IMX7D_PCIE_CTRL_ROOT_SRC] = imx_clk_hw_mux2_flags("pcie_ctrl_src", base + 0xa180, 24, 3, pcie_ctrl_sel, ARRAY_SIZE(pcie_ctrl_sel), CLK_SET_PARENT_GATE); + hws[IMX7D_PCIE_PHY_ROOT_SRC] = imx_clk_hw_mux2_flags("pcie_phy_src", base + 0xa200, 24, 3, pcie_phy_sel, ARRAY_SIZE(pcie_phy_sel), CLK_SET_PARENT_GATE); +-- +2.43.0 + diff --git a/queue-6.1/comedi-ni_routing-tools-check-when-the-file-could-no.patch b/queue-6.1/comedi-ni_routing-tools-check-when-the-file-could-no.patch new file mode 100644 index 00000000000..af0be02f355 --- /dev/null +++ b/queue-6.1/comedi-ni_routing-tools-check-when-the-file-could-no.patch @@ -0,0 +1,38 @@ +From 65661ad9f29e6f198d7a8c99c097c93b83bc6e21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 7 Sep 2024 05:30:25 +0900 +Subject: comedi: ni_routing: tools: Check when the file could not be opened + +From: Ruffalo Lavoisier + +[ Upstream commit 5baeb157b341b1d26a5815aeaa4d3bb9e0444fda ] + +- After fopen check NULL before using the file pointer use + +Signed-off-by: Ruffalo Lavoisier +Link: https://lore.kernel.org/r/20240906203025.89588-1-RuffaloLavoisier@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c b/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c +index d55521b5bdcb2..892a66b2cea66 100644 +--- a/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c ++++ b/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c +@@ -140,6 +140,11 @@ int main(void) + { + FILE *fp = fopen("ni_values.py", "w"); + ++ if (fp == NULL) { ++ fprintf(stderr, "Could not open file!"); ++ return -1; ++ } ++ + /* write route register values */ + fprintf(fp, "ni_route_values = {\n"); + for (int i = 0; ni_all_route_values[i]; ++i) +-- +2.43.0 + diff --git a/queue-6.1/driver-core-bus-return-eio-instead-of-0-when-show-st.patch b/queue-6.1/driver-core-bus-return-eio-instead-of-0-when-show-st.patch new file mode 100644 index 00000000000..6ede066bda0 --- /dev/null +++ b/queue-6.1/driver-core-bus-return-eio-instead-of-0-when-show-st.patch @@ -0,0 +1,49 @@ +From a53004b0b22ca54bdcdec9abe2043d52c715d21e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jul 2024 21:54:48 +0800 +Subject: driver core: bus: Return -EIO instead of 0 when show/store invalid + bus attribute + +From: Zijun Hu + +[ Upstream commit c0fd973c108cdc22a384854bc4b3e288a9717bb2 ] + +Return -EIO instead of 0 for below erroneous bus attribute operations: + - read a bus attribute without show(). + - write a bus attribute without store(). + +Signed-off-by: Zijun Hu +Link: https://lore.kernel.org/r/20240724-bus_fix-v2-1-5adbafc698fb@quicinc.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/base/bus.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/base/bus.c b/drivers/base/bus.c +index 7ca47e5b3c1f4..339a9edcde5f5 100644 +--- a/drivers/base/bus.c ++++ b/drivers/base/bus.c +@@ -104,7 +104,8 @@ static ssize_t bus_attr_show(struct kobject *kobj, struct attribute *attr, + { + struct bus_attribute *bus_attr = to_bus_attr(attr); + struct subsys_private *subsys_priv = to_subsys_private(kobj); +- ssize_t ret = 0; ++ /* return -EIO for reading a bus attribute without show() */ ++ ssize_t ret = -EIO; + + if (bus_attr->show) + ret = bus_attr->show(subsys_priv->bus, buf); +@@ -116,7 +117,8 @@ static ssize_t bus_attr_store(struct kobject *kobj, struct attribute *attr, + { + struct bus_attribute *bus_attr = to_bus_attr(attr); + struct subsys_private *subsys_priv = to_subsys_private(kobj); +- ssize_t ret = 0; ++ /* return -EIO for writing a bus attribute without store() */ ++ ssize_t ret = -EIO; + + if (bus_attr->store) + ret = bus_attr->store(subsys_priv->bus, buf, count); +-- +2.43.0 + diff --git a/queue-6.1/drm-amd-display-check-null-pointer-before-dereferenc.patch b/queue-6.1/drm-amd-display-check-null-pointer-before-dereferenc.patch new file mode 100644 index 00000000000..d38ba5a855f --- /dev/null +++ b/queue-6.1/drm-amd-display-check-null-pointer-before-dereferenc.patch @@ -0,0 +1,41 @@ +From 487da88c9d80ece87311ea072e14b1c8888c4317 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2024 17:30:26 -0600 +Subject: drm/amd/display: Check null pointer before dereferencing se + +From: Alex Hung + +[ Upstream commit ff599ef6970ee000fa5bc38d02fa5ff5f3fc7575 ] + +[WHAT & HOW] +se is null checked previously in the same function, indicating +it might be null; therefore, it must be checked when used again. + +This fixes 1 FORWARD_NULL issue reported by Coverity. + +Acked-by: Alex Hung +Reviewed-by: Rodrigo Siqueira +Signed-off-by: Alex Hung +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c +index 2d514e2e91a04..2721842af8067 100644 +--- a/drivers/gpu/drm/amd/display/dc/core/dc.c ++++ b/drivers/gpu/drm/amd/display/dc/core/dc.c +@@ -1659,7 +1659,7 @@ bool dc_validate_boot_timing(const struct dc *dc, + if (crtc_timing->pix_clk_100hz != pix_clk_100hz) + return false; + +- if (!se->funcs->dp_get_pixel_format) ++ if (!se || !se->funcs->dp_get_pixel_format) + return false; + + if (!se->funcs->dp_get_pixel_format( +-- +2.43.0 + diff --git a/queue-6.1/ext4-don-t-set-sb_rdonly-after-filesystem-errors.patch b/queue-6.1/ext4-don-t-set-sb_rdonly-after-filesystem-errors.patch new file mode 100644 index 00000000000..06d59c8cd0b --- /dev/null +++ b/queue-6.1/ext4-don-t-set-sb_rdonly-after-filesystem-errors.patch @@ -0,0 +1,56 @@ +From 0c89226bd429c26586865b1884f70348e07a4292 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 5 Aug 2024 22:12:41 +0200 +Subject: ext4: don't set SB_RDONLY after filesystem errors + +From: Jan Kara + +[ Upstream commit d3476f3dad4ad68ae5f6b008ea6591d1520da5d8 ] + +When the filesystem is mounted with errors=remount-ro, we were setting +SB_RDONLY flag to stop all filesystem modifications. We knew this misses +proper locking (sb->s_umount) and does not go through proper filesystem +remount procedure but it has been the way this worked since early ext2 +days and it was good enough for catastrophic situation damage +mitigation. Recently, syzbot has found a way (see link) to trigger +warnings in filesystem freezing because the code got confused by +SB_RDONLY changing under its hands. Since these days we set +EXT4_FLAGS_SHUTDOWN on the superblock which is enough to stop all +filesystem modifications, modifying SB_RDONLY shouldn't be needed. So +stop doing that. + +Link: https://lore.kernel.org/all/000000000000b90a8e061e21d12f@google.com +Reported-by: Christian Brauner +Signed-off-by: Jan Kara +Reviewed-by: Christian Brauner +Link: https://patch.msgid.link/20240805201241.27286-1-jack@suse.cz +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/super.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/fs/ext4/super.c b/fs/ext4/super.c +index 3db39758486e9..3bf214d4afef5 100644 +--- a/fs/ext4/super.c ++++ b/fs/ext4/super.c +@@ -692,11 +692,12 @@ static void ext4_handle_error(struct super_block *sb, bool force_ro, int error, + + ext4_msg(sb, KERN_CRIT, "Remounting filesystem read-only"); + /* +- * Make sure updated value of ->s_mount_flags will be visible before +- * ->s_flags update ++ * EXT4_FLAGS_SHUTDOWN was set which stops all filesystem ++ * modifications. We don't set SB_RDONLY because that requires ++ * sb->s_umount semaphore and setting it without proper remount ++ * procedure is confusing code such as freeze_super() leading to ++ * deadlocks and other problems. + */ +- smp_wmb(); +- sb->s_flags |= SB_RDONLY; + } + + static void flush_stashed_error_work(struct work_struct *work) +-- +2.43.0 + diff --git a/queue-6.1/ext4-nested-locking-for-xattr-inode.patch b/queue-6.1/ext4-nested-locking-for-xattr-inode.patch new file mode 100644 index 00000000000..851348122b3 --- /dev/null +++ b/queue-6.1/ext4-nested-locking-for-xattr-inode.patch @@ -0,0 +1,189 @@ +From cf4c83cbc031e816e2c131fda76a9b11c4e27fb0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Aug 2024 16:38:27 +0200 +Subject: ext4: nested locking for xattr inode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Wojciech Gładysz + +[ Upstream commit d1bc560e9a9c78d0b2314692847fc8661e0aeb99 ] + +Add nested locking with I_MUTEX_XATTR subclass to avoid lockdep warning +while handling xattr inode on file open syscall at ext4_xattr_inode_iget. + +Backtrace +EXT4-fs (loop0): Ignoring removed oldalloc option +====================================================== +WARNING: possible circular locking dependency detected +5.10.0-syzkaller #0 Not tainted +------------------------------------------------------ +syz-executor543/2794 is trying to acquire lock: +ffff8880215e1a48 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:782 [inline] +ffff8880215e1a48 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}, at: ext4_xattr_inode_iget+0x42a/0x5c0 fs/ext4/xattr.c:425 + +but task is already holding lock: +ffff8880215e3278 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x136d/0x19c0 fs/ext4/inode.c:5559 + +which lock already depends on the new lock. + +the existing dependency chain (in reverse order) is: + +-> #1 (&ei->i_data_sem/3){++++}-{3:3}: + lock_acquire+0x197/0x480 kernel/locking/lockdep.c:5566 + down_write+0x93/0x180 kernel/locking/rwsem.c:1564 + ext4_update_i_disksize fs/ext4/ext4.h:3267 [inline] + ext4_xattr_inode_write fs/ext4/xattr.c:1390 [inline] + ext4_xattr_inode_lookup_create fs/ext4/xattr.c:1538 [inline] + ext4_xattr_set_entry+0x331a/0x3d80 fs/ext4/xattr.c:1662 + ext4_xattr_ibody_set+0x124/0x390 fs/ext4/xattr.c:2228 + ext4_xattr_set_handle+0xc27/0x14e0 fs/ext4/xattr.c:2385 + ext4_xattr_set+0x219/0x390 fs/ext4/xattr.c:2498 + ext4_xattr_user_set+0xc9/0xf0 fs/ext4/xattr_user.c:40 + __vfs_setxattr+0x404/0x450 fs/xattr.c:177 + __vfs_setxattr_noperm+0x11d/0x4f0 fs/xattr.c:208 + __vfs_setxattr_locked+0x1f9/0x210 fs/xattr.c:266 + vfs_setxattr+0x112/0x2c0 fs/xattr.c:283 + setxattr+0x1db/0x3e0 fs/xattr.c:548 + path_setxattr+0x15a/0x240 fs/xattr.c:567 + __do_sys_setxattr fs/xattr.c:582 [inline] + __se_sys_setxattr fs/xattr.c:578 [inline] + __x64_sys_setxattr+0xc5/0xe0 fs/xattr.c:578 + do_syscall_64+0x6d/0xa0 arch/x86/entry/common.c:62 + entry_SYSCALL_64_after_hwframe+0x61/0xcb + +-> #0 (&ea_inode->i_rwsem#7/1){+.+.}-{3:3}: + check_prev_add kernel/locking/lockdep.c:2988 [inline] + check_prevs_add kernel/locking/lockdep.c:3113 [inline] + validate_chain+0x1695/0x58f0 kernel/locking/lockdep.c:3729 + __lock_acquire+0x12fd/0x20d0 kernel/locking/lockdep.c:4955 + lock_acquire+0x197/0x480 kernel/locking/lockdep.c:5566 + down_write+0x93/0x180 kernel/locking/rwsem.c:1564 + inode_lock include/linux/fs.h:782 [inline] + ext4_xattr_inode_iget+0x42a/0x5c0 fs/ext4/xattr.c:425 + ext4_xattr_inode_get+0x138/0x410 fs/ext4/xattr.c:485 + ext4_xattr_move_to_block fs/ext4/xattr.c:2580 [inline] + ext4_xattr_make_inode_space fs/ext4/xattr.c:2682 [inline] + ext4_expand_extra_isize_ea+0xe70/0x1bb0 fs/ext4/xattr.c:2774 + __ext4_expand_extra_isize+0x304/0x3f0 fs/ext4/inode.c:5898 + ext4_try_to_expand_extra_isize fs/ext4/inode.c:5941 [inline] + __ext4_mark_inode_dirty+0x591/0x810 fs/ext4/inode.c:6018 + ext4_setattr+0x1400/0x19c0 fs/ext4/inode.c:5562 + notify_change+0xbb6/0xe60 fs/attr.c:435 + do_truncate+0x1de/0x2c0 fs/open.c:64 + handle_truncate fs/namei.c:2970 [inline] + do_open fs/namei.c:3311 [inline] + path_openat+0x29f3/0x3290 fs/namei.c:3425 + do_filp_open+0x20b/0x450 fs/namei.c:3452 + do_sys_openat2+0x124/0x460 fs/open.c:1207 + do_sys_open fs/open.c:1223 [inline] + __do_sys_open fs/open.c:1231 [inline] + __se_sys_open fs/open.c:1227 [inline] + __x64_sys_open+0x221/0x270 fs/open.c:1227 + do_syscall_64+0x6d/0xa0 arch/x86/entry/common.c:62 + entry_SYSCALL_64_after_hwframe+0x61/0xcb + +other info that might help us debug this: + + Possible unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock(&ei->i_data_sem/3); + lock(&ea_inode->i_rwsem#7/1); + lock(&ei->i_data_sem/3); + lock(&ea_inode->i_rwsem#7/1); + + *** DEADLOCK *** + +5 locks held by syz-executor543/2794: + #0: ffff888026fbc448 (sb_writers#4){.+.+}-{0:0}, at: mnt_want_write+0x4a/0x2a0 fs/namespace.c:365 + #1: ffff8880215e3488 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: inode_lock include/linux/fs.h:782 [inline] + #1: ffff8880215e3488 (&sb->s_type->i_mutex_key#7){++++}-{3:3}, at: do_truncate+0x1cf/0x2c0 fs/open.c:62 + #2: ffff8880215e3310 (&ei->i_mmap_sem){++++}-{3:3}, at: ext4_setattr+0xec4/0x19c0 fs/ext4/inode.c:5519 + #3: ffff8880215e3278 (&ei->i_data_sem/3){++++}-{3:3}, at: ext4_setattr+0x136d/0x19c0 fs/ext4/inode.c:5559 + #4: ffff8880215e30c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_write_trylock_xattr fs/ext4/xattr.h:162 [inline] + #4: ffff8880215e30c8 (&ei->xattr_sem){++++}-{3:3}, at: ext4_try_to_expand_extra_isize fs/ext4/inode.c:5938 [inline] + #4: ffff8880215e30c8 (&ei->xattr_sem){++++}-{3:3}, at: __ext4_mark_inode_dirty+0x4fb/0x810 fs/ext4/inode.c:6018 + +stack backtrace: +CPU: 1 PID: 2794 Comm: syz-executor543 Not tainted 5.10.0-syzkaller #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 +Call Trace: + __dump_stack lib/dump_stack.c:77 [inline] + dump_stack+0x177/0x211 lib/dump_stack.c:118 + print_circular_bug+0x146/0x1b0 kernel/locking/lockdep.c:2002 + check_noncircular+0x2cc/0x390 kernel/locking/lockdep.c:2123 + check_prev_add kernel/locking/lockdep.c:2988 [inline] + check_prevs_add kernel/locking/lockdep.c:3113 [inline] + validate_chain+0x1695/0x58f0 kernel/locking/lockdep.c:3729 + __lock_acquire+0x12fd/0x20d0 kernel/locking/lockdep.c:4955 + lock_acquire+0x197/0x480 kernel/locking/lockdep.c:5566 + down_write+0x93/0x180 kernel/locking/rwsem.c:1564 + inode_lock include/linux/fs.h:782 [inline] + ext4_xattr_inode_iget+0x42a/0x5c0 fs/ext4/xattr.c:425 + ext4_xattr_inode_get+0x138/0x410 fs/ext4/xattr.c:485 + ext4_xattr_move_to_block fs/ext4/xattr.c:2580 [inline] + ext4_xattr_make_inode_space fs/ext4/xattr.c:2682 [inline] + ext4_expand_extra_isize_ea+0xe70/0x1bb0 fs/ext4/xattr.c:2774 + __ext4_expand_extra_isize+0x304/0x3f0 fs/ext4/inode.c:5898 + ext4_try_to_expand_extra_isize fs/ext4/inode.c:5941 [inline] + __ext4_mark_inode_dirty+0x591/0x810 fs/ext4/inode.c:6018 + ext4_setattr+0x1400/0x19c0 fs/ext4/inode.c:5562 + notify_change+0xbb6/0xe60 fs/attr.c:435 + do_truncate+0x1de/0x2c0 fs/open.c:64 + handle_truncate fs/namei.c:2970 [inline] + do_open fs/namei.c:3311 [inline] + path_openat+0x29f3/0x3290 fs/namei.c:3425 + do_filp_open+0x20b/0x450 fs/namei.c:3452 + do_sys_openat2+0x124/0x460 fs/open.c:1207 + do_sys_open fs/open.c:1223 [inline] + __do_sys_open fs/open.c:1231 [inline] + __se_sys_open fs/open.c:1227 [inline] + __x64_sys_open+0x221/0x270 fs/open.c:1227 + do_syscall_64+0x6d/0xa0 arch/x86/entry/common.c:62 + entry_SYSCALL_64_after_hwframe+0x61/0xcb +RIP: 0033:0x7f0cde4ea229 +Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 21 18 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 +RSP: 002b:00007ffd81d1c978 EFLAGS: 00000246 ORIG_RAX: 0000000000000002 +RAX: ffffffffffffffda RBX: 0030656c69662f30 RCX: 00007f0cde4ea229 +RDX: 0000000000000089 RSI: 00000000000a0a00 RDI: 00000000200001c0 +RBP: 2f30656c69662f2e R08: 0000000000208000 R09: 0000000000208000 +R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffd81d1c9c0 +R13: 00007ffd81d1ca00 R14: 0000000000080000 R15: 0000000000000003 +EXT4-fs error (device loop0): ext4_expand_extra_isize_ea:2730: inode #13: comm syz-executor543: corrupted in-inode xattr + +Signed-off-by: Wojciech Gładysz +Link: https://patch.msgid.link/20240801143827.19135-1-wojciech.gladysz@infogain.com +Signed-off-by: Theodore Ts'o +Signed-off-by: Sasha Levin +--- + fs/ext4/xattr.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c +index 7c35ca15571b8..5598aec757752 100644 +--- a/fs/ext4/xattr.c ++++ b/fs/ext4/xattr.c +@@ -422,7 +422,7 @@ static int ext4_xattr_inode_iget(struct inode *parent, unsigned long ea_ino, + ext4_set_inode_state(inode, EXT4_STATE_LUSTRE_EA_INODE); + ext4_xattr_inode_set_ref(inode, 1); + } else { +- inode_lock(inode); ++ inode_lock_nested(inode, I_MUTEX_XATTR); + inode->i_flags |= S_NOQUOTA; + inode_unlock(inode); + } +@@ -990,7 +990,7 @@ static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_inode, + s64 ref_count; + int ret; + +- inode_lock(ea_inode); ++ inode_lock_nested(ea_inode, I_MUTEX_XATTR); + + ret = ext4_reserve_inode_write(handle, ea_inode, &iloc); + if (ret) +-- +2.43.0 + diff --git a/queue-6.1/fbcon-fix-a-null-pointer-dereference-issue-in-fbcon_.patch b/queue-6.1/fbcon-fix-a-null-pointer-dereference-issue-in-fbcon_.patch new file mode 100644 index 00000000000..a6aae2d5dda --- /dev/null +++ b/queue-6.1/fbcon-fix-a-null-pointer-dereference-issue-in-fbcon_.patch @@ -0,0 +1,88 @@ +From dbccfc31087420f9ec4eecc9c81888b4ec057dab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Sep 2024 13:29:36 +0800 +Subject: fbcon: Fix a NULL pointer dereference issue in fbcon_putcs + +From: Qianqiang Liu + +[ Upstream commit 5b97eebcce1b4f3f07a71f635d6aa3af96c236e7 ] + +syzbot has found a NULL pointer dereference bug in fbcon. +Here is the simplified C reproducer: + +struct param { + uint8_t type; + struct tiocl_selection ts; +}; + +int main() +{ + struct fb_con2fbmap con2fb; + struct param param; + + int fd = open("/dev/fb1", 0, 0); + + con2fb.console = 0x19; + con2fb.framebuffer = 0; + ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb); + + param.type = 2; + param.ts.xs = 0; param.ts.ys = 0; + param.ts.xe = 0; param.ts.ye = 0; + param.ts.sel_mode = 0; + + int fd1 = open("/dev/tty1", O_RDWR, 0); + ioctl(fd1, TIOCLINUX, ¶m); + + con2fb.console = 1; + con2fb.framebuffer = 0; + ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb); + + return 0; +} + +After calling ioctl(fd1, TIOCLINUX, ¶m), the subsequent ioctl(fd, FBIOPUT_CON2FBMAP, &con2fb) +causes the kernel to follow a different execution path: + + set_con2fb_map + -> con2fb_init_display + -> fbcon_set_disp + -> redraw_screen + -> hide_cursor + -> clear_selection + -> highlight + -> invert_screen + -> do_update_region + -> fbcon_putcs + -> ops->putcs + +Since ops->putcs is a NULL pointer, this leads to a kernel panic. +To prevent this, we need to call set_blitting_type() within set_con2fb_map() +to properly initialize ops->putcs. + +Reported-by: syzbot+3d613ae53c031502687a@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=3d613ae53c031502687a +Tested-by: syzbot+3d613ae53c031502687a@syzkaller.appspotmail.com +Signed-off-by: Qianqiang Liu +Signed-off-by: Helge Deller +Signed-off-by: Sasha Levin +--- + drivers/video/fbdev/core/fbcon.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c +index 14498a0d13e0b..e6640edec155e 100644 +--- a/drivers/video/fbdev/core/fbcon.c ++++ b/drivers/video/fbdev/core/fbcon.c +@@ -847,6 +847,8 @@ static int set_con2fb_map(int unit, int newidx, int user) + return err; + + fbcon_add_cursor_work(info); ++ } else if (vc) { ++ set_blitting_type(vc, info); + } + + con2fb_map[unit] = newidx; +-- +2.43.0 + diff --git a/queue-6.1/fbdev-sisfb-fix-strbuf-array-overflow.patch b/queue-6.1/fbdev-sisfb-fix-strbuf-array-overflow.patch new file mode 100644 index 00000000000..ef9024b9ae6 --- /dev/null +++ b/queue-6.1/fbdev-sisfb-fix-strbuf-array-overflow.patch @@ -0,0 +1,42 @@ +From b3cb16ad71369427f59cb5d1fafff56cec513f9b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Sep 2024 22:34:24 +0300 +Subject: fbdev: sisfb: Fix strbuf array overflow + +From: Andrey Shumilin + +[ Upstream commit 9cf14f5a2746c19455ce9cb44341b5527b5e19c3 ] + +The values of the variables xres and yres are placed in strbuf. +These variables are obtained from strbuf1. +The strbuf1 array contains digit characters +and a space if the array contains non-digit characters. +Then, when executing sprintf(strbuf, "%ux%ux8", xres, yres); +more than 16 bytes will be written to strbuf. +It is suggested to increase the size of the strbuf array to 24. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Signed-off-by: Andrey Shumilin +Signed-off-by: Helge Deller +Signed-off-by: Sasha Levin +--- + drivers/video/fbdev/sis/sis_main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/sis_main.c +index fe8996461b9ef..7b83d73eb0a04 100644 +--- a/drivers/video/fbdev/sis/sis_main.c ++++ b/drivers/video/fbdev/sis/sis_main.c +@@ -184,7 +184,7 @@ static void sisfb_search_mode(char *name, bool quiet) + { + unsigned int j = 0, xres = 0, yres = 0, depth = 0, rate = 0; + int i = 0; +- char strbuf[16], strbuf1[20]; ++ char strbuf[24], strbuf1[20]; + char *nameptr = name; + + /* We don't know the hardware specs yet and there is no ivideo */ +-- +2.43.0 + diff --git a/queue-6.1/i2c-i801-use-a-different-adapter-name-for-idf-adapte.patch b/queue-6.1/i2c-i801-use-a-different-adapter-name-for-idf-adapte.patch new file mode 100644 index 00000000000..5b77f3c3acc --- /dev/null +++ b/queue-6.1/i2c-i801-use-a-different-adapter-name-for-idf-adapte.patch @@ -0,0 +1,55 @@ +From 7f5a664eadc85298cafe04a363b9d55520f513a6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 12 Aug 2024 22:39:48 +0200 +Subject: i2c: i801: Use a different adapter-name for IDF adapters +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Hans de Goede + +[ Upstream commit 43457ada98c824f310adb7bd96bd5f2fcd9a3279 ] + +On chipsets with a second 'Integrated Device Function' SMBus controller use +a different adapter-name for the second IDF adapter. + +This allows platform glue code which is looking for the primary i801 +adapter to manually instantiate i2c_clients on to differentiate +between the 2. + +This allows such code to find the primary i801 adapter by name, without +needing to duplicate the PCI-ids to feature-flags mapping from i2c-i801.c. + +Reviewed-by: Pali Rohár +Signed-off-by: Hans de Goede +Acked-by: Wolfram Sang +Signed-off-by: Andi Shyti +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-i801.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c +index 208c7741bc681..d3ecd65b0542a 100644 +--- a/drivers/i2c/busses/i2c-i801.c ++++ b/drivers/i2c/busses/i2c-i801.c +@@ -1751,8 +1751,15 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) + + i801_add_tco(priv); + ++ /* ++ * adapter.name is used by platform code to find the main I801 adapter ++ * to instantiante i2c_clients, do not change. ++ */ + snprintf(priv->adapter.name, sizeof(priv->adapter.name), +- "SMBus I801 adapter at %04lx", priv->smba); ++ "SMBus %s adapter at %04lx", ++ (priv->features & FEATURE_IDF) ? "I801 IDF" : "I801", ++ priv->smba); ++ + err = i2c_add_adapter(&priv->adapter); + if (err) { + platform_device_unregister(priv->tco_pdev); +-- +2.43.0 + diff --git a/queue-6.1/io_uring-check-if-we-need-to-reschedule-during-overf.patch b/queue-6.1/io_uring-check-if-we-need-to-reschedule-during-overf.patch new file mode 100644 index 00000000000..3fcb2955a55 --- /dev/null +++ b/queue-6.1/io_uring-check-if-we-need-to-reschedule-during-overf.patch @@ -0,0 +1,57 @@ +From aab12a3f8e9c2ab47e685dcfd3c6582b7d78e099 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Sep 2024 02:51:20 -0600 +Subject: io_uring: check if we need to reschedule during overflow flush + +From: Jens Axboe + +[ Upstream commit eac2ca2d682f94f46b1973bdf5e77d85d77b8e53 ] + +In terms of normal application usage, this list will always be empty. +And if an application does overflow a bit, it'll have a few entries. +However, nothing obviously prevents syzbot from running a test case +that generates a ton of overflow entries, and then flushing them can +take quite a while. + +Check for needing to reschedule while flushing, and drop our locks and +do so if necessary. There's no state to maintain here as overflows +always prune from head-of-list, hence it's fine to drop and reacquire +the locks at the end of the loop. + +Link: https://lore.kernel.org/io-uring/66ed061d.050a0220.29194.0053.GAE@google.com/ +Reported-by: syzbot+5fca234bd7eb378ff78e@syzkaller.appspotmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + io_uring/io_uring.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c +index b21f2bafaeb04..f902b161f02ca 100644 +--- a/io_uring/io_uring.c ++++ b/io_uring/io_uring.c +@@ -615,6 +615,21 @@ static bool __io_cqring_overflow_flush(struct io_ring_ctx *ctx, bool force) + + list_del(&ocqe->list); + kfree(ocqe); ++ ++ /* ++ * For silly syzbot cases that deliberately overflow by huge ++ * amounts, check if we need to resched and drop and ++ * reacquire the locks if so. Nothing real would ever hit this. ++ * Ideally we'd have a non-posting unlock for this, but hard ++ * to care for a non-real case. ++ */ ++ if (need_resched()) { ++ io_cq_unlock_post(ctx); ++ mutex_unlock(&ctx->uring_lock); ++ cond_resched(); ++ mutex_lock(&ctx->uring_lock); ++ io_cq_lock(ctx); ++ } + } + + all_flushed = list_empty(&ctx->cq_overflow_list); +-- +2.43.0 + diff --git a/queue-6.1/ktest.pl-avoid-false-positives-with-grub2-skip-regex.patch b/queue-6.1/ktest.pl-avoid-false-positives-with-grub2-skip-regex.patch new file mode 100644 index 00000000000..137fdf6612b --- /dev/null +++ b/queue-6.1/ktest.pl-avoid-false-positives-with-grub2-skip-regex.patch @@ -0,0 +1,52 @@ +From e6799577deb607449dc5bad375af82a69da829cb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Sep 2024 13:55:30 -0400 +Subject: ktest.pl: Avoid false positives with grub2 skip regex + +From: Daniel Jordan + +[ Upstream commit 2351e8c65404aabc433300b6bf90c7a37e8bbc4d ] + +Some distros have grub2 config files with the lines + + if [ x"${feature_menuentry_id}" = xy ]; then + menuentry_id_option="--id" + else + menuentry_id_option="" + fi + +which match the skip regex defined for grub2 in get_grub_index(): + + $skip = '^\s*menuentry'; + +These false positives cause the grub number to be higher than it +should be, and the wrong kernel can end up booting. + +Grub documents the menuentry command with whitespace between it and the +title, so make the skip regex reflect this. + +Link: https://lore.kernel.org/20240904175530.84175-1-daniel.m.jordan@oracle.com +Signed-off-by: Daniel Jordan +Acked-by: John 'Warthog9' Hawley (Tenstorrent) +Signed-off-by: Steven Rostedt +Signed-off-by: Sasha Levin +--- + tools/testing/ktest/ktest.pl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl +index 449e45bd69665..99e17a0a13649 100755 +--- a/tools/testing/ktest/ktest.pl ++++ b/tools/testing/ktest/ktest.pl +@@ -2036,7 +2036,7 @@ sub get_grub_index { + } elsif ($reboot_type eq "grub2") { + $command = "cat $grub_file"; + $target = '^\s*menuentry.*' . $grub_menu_qt; +- $skip = '^\s*menuentry'; ++ $skip = '^\s*menuentry\s'; + $submenu = '^\s*submenu\s'; + } elsif ($reboot_type eq "grub2bls") { + $command = $grub_bls_get; +-- +2.43.0 + diff --git a/queue-6.1/loongarch-fix-memleak-in-pci_acpi_scan_root.patch b/queue-6.1/loongarch-fix-memleak-in-pci_acpi_scan_root.patch new file mode 100644 index 00000000000..1f30309739e --- /dev/null +++ b/queue-6.1/loongarch-fix-memleak-in-pci_acpi_scan_root.patch @@ -0,0 +1,35 @@ +From f643bb2799938ae78894be6db3688ff630d2b629 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Sep 2024 15:32:20 +0800 +Subject: LoongArch: Fix memleak in pci_acpi_scan_root() + +From: Wentao Guan + +[ Upstream commit 5016c3a31a6d74eaf2fdfdec673eae8fcf90379e ] + +Add kfree(root_ops) in this case to avoid memleak of root_ops, +leaks when pci_find_bus() != 0. + +Signed-off-by: Yuli Wang +Signed-off-by: Wentao Guan +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/pci/acpi.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/loongarch/pci/acpi.c b/arch/loongarch/pci/acpi.c +index 8235ec92b41fe..debd79f712860 100644 +--- a/arch/loongarch/pci/acpi.c ++++ b/arch/loongarch/pci/acpi.c +@@ -222,6 +222,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root) + if (bus) { + memcpy(bus->sysdata, info->cfg, sizeof(struct pci_config_window)); + kfree(info); ++ kfree(root_ops); + } else { + struct pci_bus *child; + +-- +2.43.0 + diff --git a/queue-6.1/media-videobuf2-core-clear-memory-related-fields-in-.patch b/queue-6.1/media-videobuf2-core-clear-memory-related-fields-in-.patch new file mode 100644 index 00000000000..7c187ed59d2 --- /dev/null +++ b/queue-6.1/media-videobuf2-core-clear-memory-related-fields-in-.patch @@ -0,0 +1,52 @@ +From 580bf5ce1e20405b2afb567456f359198678b9b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 14 Aug 2024 11:06:40 +0900 +Subject: media: videobuf2-core: clear memory related fields in + __vb2_plane_dmabuf_put() + +From: Yunke Cao + +[ Upstream commit 6a9c97ab6b7e85697e0b74e86062192a5ffffd99 ] + +Clear vb2_plane's memory related fields in __vb2_plane_dmabuf_put(), +including bytesused, length, fd and data_offset. + +Remove the duplicated code in __prepare_dmabuf(). + +Signed-off-by: Yunke Cao +Acked-by: Tomasz Figa +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/common/videobuf2/videobuf2-core.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c +index 92efc4676df6d..a50a1f0a7342c 100644 +--- a/drivers/media/common/videobuf2/videobuf2-core.c ++++ b/drivers/media/common/videobuf2/videobuf2-core.c +@@ -302,6 +302,10 @@ static void __vb2_plane_dmabuf_put(struct vb2_buffer *vb, struct vb2_plane *p) + p->mem_priv = NULL; + p->dbuf = NULL; + p->dbuf_mapped = 0; ++ p->bytesused = 0; ++ p->length = 0; ++ p->m.fd = 0; ++ p->data_offset = 0; + } + + /* +@@ -1310,10 +1314,6 @@ static int __prepare_dmabuf(struct vb2_buffer *vb) + + /* Release previously acquired memory if present */ + __vb2_plane_dmabuf_put(vb, &vb->planes[plane]); +- vb->planes[plane].bytesused = 0; +- vb->planes[plane].length = 0; +- vb->planes[plane].m.fd = 0; +- vb->planes[plane].data_offset = 0; + + /* Acquire each plane's memory */ + mem_priv = call_ptr_memop(attach_dmabuf, +-- +2.43.0 + diff --git a/queue-6.1/netfilter-nf_reject-fix-build-warning-when-config_br.patch b/queue-6.1/netfilter-nf_reject-fix-build-warning-when-config_br.patch new file mode 100644 index 00000000000..bdbd91c58f6 --- /dev/null +++ b/queue-6.1/netfilter-nf_reject-fix-build-warning-when-config_br.patch @@ -0,0 +1,115 @@ +From de86d1c3aed368dc1a8e38831727e00f27882843 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Sep 2024 10:50:34 +0100 +Subject: netfilter: nf_reject: Fix build warning when + CONFIG_BRIDGE_NETFILTER=n + +From: Simon Horman + +[ Upstream commit fc56878ca1c288e49b5cbb43860a5938e3463654 ] + +If CONFIG_BRIDGE_NETFILTER is not enabled, which is the case for x86_64 +defconfig, then building nf_reject_ipv4.c and nf_reject_ipv6.c with W=1 +using gcc-14 results in the following warnings, which are treated as +errors: + +net/ipv4/netfilter/nf_reject_ipv4.c: In function 'nf_send_reset': +net/ipv4/netfilter/nf_reject_ipv4.c:243:23: error: variable 'niph' set but not used [-Werror=unused-but-set-variable] + 243 | struct iphdr *niph; + | ^~~~ +cc1: all warnings being treated as errors +net/ipv6/netfilter/nf_reject_ipv6.c: In function 'nf_send_reset6': +net/ipv6/netfilter/nf_reject_ipv6.c:286:25: error: variable 'ip6h' set but not used [-Werror=unused-but-set-variable] + 286 | struct ipv6hdr *ip6h; + | ^~~~ +cc1: all warnings being treated as errors + +Address this by reducing the scope of these local variables to where +they are used, which is code only compiled when CONFIG_BRIDGE_NETFILTER +enabled. + +Compile tested and run through netfilter selftests. + +Reported-by: Andy Shevchenko +Closes: https://lore.kernel.org/netfilter-devel/20240906145513.567781-1-andriy.shevchenko@linux.intel.com/ +Signed-off-by: Simon Horman +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/ipv4/netfilter/nf_reject_ipv4.c | 10 ++++------ + net/ipv6/netfilter/nf_reject_ipv6.c | 5 ++--- + 2 files changed, 6 insertions(+), 9 deletions(-) + +diff --git a/net/ipv4/netfilter/nf_reject_ipv4.c b/net/ipv4/netfilter/nf_reject_ipv4.c +index fc761915c5f6f..675b5bbed638e 100644 +--- a/net/ipv4/netfilter/nf_reject_ipv4.c ++++ b/net/ipv4/netfilter/nf_reject_ipv4.c +@@ -239,9 +239,8 @@ static int nf_reject_fill_skb_dst(struct sk_buff *skb_in) + void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb, + int hook) + { +- struct sk_buff *nskb; +- struct iphdr *niph; + const struct tcphdr *oth; ++ struct sk_buff *nskb; + struct tcphdr _oth; + + oth = nf_reject_ip_tcphdr_get(oldskb, &_oth, hook); +@@ -266,14 +265,12 @@ void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb, + nskb->mark = IP4_REPLY_MARK(net, oldskb->mark); + + skb_reserve(nskb, LL_MAX_HEADER); +- niph = nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, +- ip4_dst_hoplimit(skb_dst(nskb))); ++ nf_reject_iphdr_put(nskb, oldskb, IPPROTO_TCP, ++ ip4_dst_hoplimit(skb_dst(nskb))); + nf_reject_ip_tcphdr_put(nskb, oldskb, oth); + if (ip_route_me_harder(net, sk, nskb, RTN_UNSPEC)) + goto free_nskb; + +- niph = ip_hdr(nskb); +- + /* "Never happens" */ + if (nskb->len > dst_mtu(skb_dst(nskb))) + goto free_nskb; +@@ -290,6 +287,7 @@ void nf_send_reset(struct net *net, struct sock *sk, struct sk_buff *oldskb, + */ + if (nf_bridge_info_exists(oldskb)) { + struct ethhdr *oeth = eth_hdr(oldskb); ++ struct iphdr *niph = ip_hdr(nskb); + struct net_device *br_indev; + + br_indev = nf_bridge_get_physindev(oldskb, net); +diff --git a/net/ipv6/netfilter/nf_reject_ipv6.c b/net/ipv6/netfilter/nf_reject_ipv6.c +index 690d1c0476913..4e0976534648c 100644 +--- a/net/ipv6/netfilter/nf_reject_ipv6.c ++++ b/net/ipv6/netfilter/nf_reject_ipv6.c +@@ -273,7 +273,6 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, + const struct tcphdr *otcph; + unsigned int otcplen, hh_len; + const struct ipv6hdr *oip6h = ipv6_hdr(oldskb); +- struct ipv6hdr *ip6h; + struct dst_entry *dst = NULL; + struct flowi6 fl6; + +@@ -329,8 +328,7 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, + nskb->mark = fl6.flowi6_mark; + + skb_reserve(nskb, hh_len + dst->header_len); +- ip6h = nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, +- ip6_dst_hoplimit(dst)); ++ nf_reject_ip6hdr_put(nskb, oldskb, IPPROTO_TCP, ip6_dst_hoplimit(dst)); + nf_reject_ip6_tcphdr_put(nskb, oldskb, otcph, otcplen); + + nf_ct_attach(nskb, oldskb); +@@ -345,6 +343,7 @@ void nf_send_reset6(struct net *net, struct sock *sk, struct sk_buff *oldskb, + */ + if (nf_bridge_info_exists(oldskb)) { + struct ethhdr *oeth = eth_hdr(oldskb); ++ struct ipv6hdr *ip6h = ipv6_hdr(nskb); + struct net_device *br_indev; + + br_indev = nf_bridge_get_physindev(oldskb, net); +-- +2.43.0 + diff --git a/queue-6.1/ntb-ntb_hw_switchtec-fix-use-after-free-vulnerabilit.patch b/queue-6.1/ntb-ntb_hw_switchtec-fix-use-after-free-vulnerabilit.patch new file mode 100644 index 00000000000..4c82defa8bd --- /dev/null +++ b/queue-6.1/ntb-ntb_hw_switchtec-fix-use-after-free-vulnerabilit.patch @@ -0,0 +1,54 @@ +From 230133e77f7c196f57d79553067b54b8587e7ce1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Sep 2024 01:20:07 +0800 +Subject: ntb: ntb_hw_switchtec: Fix use after free vulnerability in + switchtec_ntb_remove due to race condition + +From: Kaixin Wang + +[ Upstream commit e51aded92d42784313ba16c12f4f88cc4f973bbb ] + +In the switchtec_ntb_add function, it can call switchtec_ntb_init_sndev +function, then &sndev->check_link_status_work is bound with +check_link_status_work. switchtec_ntb_link_notification may be called +to start the work. + +If we remove the module which will call switchtec_ntb_remove to make +cleanup, it will free sndev through kfree(sndev), while the work +mentioned above will be used. The sequence of operations that may lead +to a UAF bug is as follows: + +CPU0 CPU1 + + | check_link_status_work +switchtec_ntb_remove | +kfree(sndev); | + | if (sndev->link_force_down) + | // use sndev + +Fix it by ensuring that the work is canceled before proceeding with +the cleanup in switchtec_ntb_remove. + +Signed-off-by: Kaixin Wang +Reviewed-by: Logan Gunthorpe +Signed-off-by: Jon Mason +Signed-off-by: Sasha Levin +--- + drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +index 88ae18b0efa8d..7ce65a00db56b 100644 +--- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c ++++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +@@ -1556,6 +1556,7 @@ static void switchtec_ntb_remove(struct device *dev, + switchtec_ntb_deinit_db_msg_irq(sndev); + switchtec_ntb_deinit_shared_mw(sndev); + switchtec_ntb_deinit_crosslink(sndev); ++ cancel_work_sync(&sndev->check_link_status_work); + kfree(sndev); + dev_info(dev, "ntb device unregistered\n"); + } +-- +2.43.0 + diff --git a/queue-6.1/pci-add-acs-quirk-for-qualcomm-sa8775p.patch b/queue-6.1/pci-add-acs-quirk-for-qualcomm-sa8775p.patch new file mode 100644 index 00000000000..850f347499e --- /dev/null +++ b/queue-6.1/pci-add-acs-quirk-for-qualcomm-sa8775p.patch @@ -0,0 +1,42 @@ +From 3822b7a16b54b149d0f64e48e011e34db5a08389 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Sep 2024 10:52:27 +0530 +Subject: PCI: Add ACS quirk for Qualcomm SA8775P +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Subramanian Ananthanarayanan + +[ Upstream commit 026f84d3fa62d215b11cbeb5a5d97df941e93b5c ] + +The Qualcomm SA8775P root ports don't advertise an ACS capability, but they +do provide ACS-like features to disable peer transactions and validate bus +numbers in requests. + +Thus, add an ACS quirk for the SA8775P. + +Link: https://lore.kernel.org/linux-pci/20240906052228.1829485-1-quic_skananth@quicinc.com +Signed-off-by: Subramanian Ananthanarayanan +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 7ebce76778f71..131c75769b993 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -4972,6 +4972,8 @@ static const struct pci_dev_acs_enabled { + /* QCOM QDF2xxx root ports */ + { PCI_VENDOR_ID_QCOM, 0x0400, pci_quirk_qcom_rp_acs }, + { PCI_VENDOR_ID_QCOM, 0x0401, pci_quirk_qcom_rp_acs }, ++ /* QCOM SA8775P root port */ ++ { PCI_VENDOR_ID_QCOM, 0x0115, pci_quirk_qcom_rp_acs }, + /* HXT SD4800 root ports. The ACS design is same as QCOM QDF2xxx */ + { PCI_VENDOR_ID_HXT, 0x0401, pci_quirk_qcom_rp_acs }, + /* Intel PCH root ports */ +-- +2.43.0 + diff --git a/queue-6.1/pci-add-function-0-dma-alias-quirk-for-glenfly-arise.patch b/queue-6.1/pci-add-function-0-dma-alias-quirk-for-glenfly-arise.patch new file mode 100644 index 00000000000..8791deef745 --- /dev/null +++ b/queue-6.1/pci-add-function-0-dma-alias-quirk-for-glenfly-arise.patch @@ -0,0 +1,69 @@ +From 969f0f37f26c3812264edb9ef7a11cae118175bd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Aug 2024 17:57:08 +0800 +Subject: PCI: Add function 0 DMA alias quirk for Glenfly Arise chip + +From: WangYuli + +[ Upstream commit 9246b487ab3c3b5993aae7552b7a4c541cc14a49 ] + +Add DMA support for audio function of Glenfly Arise chip, which uses +Requester ID of function 0. + +Link: https://lore.kernel.org/r/CA2BBD087345B6D1+20240823095708.3237375-1-wangyuli@uniontech.com +Signed-off-by: SiyuLi +Signed-off-by: WangYuli +[bhelgaas: lower-case hex to match local code, drop unused Device IDs] +Signed-off-by: Bjorn Helgaas +Reviewed-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 4 ++++ + include/linux/pci_ids.h | 2 ++ + sound/pci/hda/hda_intel.c | 2 +- + 3 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 56dce858a6934..7ebce76778f71 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -4144,6 +4144,10 @@ static void quirk_dma_func0_alias(struct pci_dev *dev) + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias); + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe476, quirk_dma_func0_alias); + ++/* Some Glenfly chips use function 0 as the PCIe Requester ID for DMA */ ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GLENFLY, 0x3d40, quirk_dma_func0_alias); ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_GLENFLY, 0x3d41, quirk_dma_func0_alias); ++ + static void quirk_dma_func1_alias(struct pci_dev *dev) + { + if (PCI_FUNC(dev->devfn) != 1) +diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h +index f680897794fa2..69b8c46a42ea7 100644 +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -2638,6 +2638,8 @@ + #define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 + #define PCI_DEVICE_ID_DCI_PCCOM2 0x0004 + ++#define PCI_VENDOR_ID_GLENFLY 0x6766 ++ + #define PCI_VENDOR_ID_INTEL 0x8086 + #define PCI_DEVICE_ID_INTEL_EESSC 0x0008 + #define PCI_DEVICE_ID_INTEL_PXHD_0 0x0320 +diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c +index a26f2a2d44cf2..b8d769b2d0f9a 100644 +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2748,7 +2748,7 @@ static const struct pci_device_id azx_ids[] = { + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, + /* GLENFLY */ +- { PCI_DEVICE(0x6766, PCI_ANY_ID), ++ { PCI_DEVICE(PCI_VENDOR_ID_GLENFLY, PCI_ANY_ID), + .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, + .class_mask = 0xffffff, + .driver_data = AZX_DRIVER_GFHDMI | AZX_DCAPS_POSFIX_LPIB | +-- +2.43.0 + diff --git a/queue-6.1/pci-mark-creative-labs-emu20k2-intx-masking-as-broke.patch b/queue-6.1/pci-mark-creative-labs-emu20k2-intx-masking-as-broke.patch new file mode 100644 index 00000000000..1f606c2d613 --- /dev/null +++ b/queue-6.1/pci-mark-creative-labs-emu20k2-intx-masking-as-broke.patch @@ -0,0 +1,45 @@ +From 27a5d7d48fced8a4b72ebc0cdabbad3b0ac3cd3a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Sep 2024 15:53:27 -0600 +Subject: PCI: Mark Creative Labs EMU20k2 INTx masking as broken +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alex Williamson + +[ Upstream commit 2910306655a7072640021563ec9501bfa67f0cb1 ] + +Per user reports, the Creative Labs EMU20k2 (Sound Blaster X-Fi +Titanium Series) generates spurious interrupts when used with +vfio-pci unless DisINTx masking support is disabled. + +Thus, quirk the device to mark INTx masking as broken. + +Closes: https://lore.kernel.org/all/VI1PR10MB8207C507DB5420AB4C7281E0DB9A2@VI1PR10MB8207.EURPRD10.PROD.OUTLOOK.COM +Link: https://lore.kernel.org/linux-pci/20240912215331.839220-1-alex.williamson@redhat.com +Reported-by: zdravko delineshev +Signed-off-by: Alex Williamson +[kwilczynski: commit log] +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index 131c75769b993..8887f3b3b38f0 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -3506,6 +3506,8 @@ DECLARE_PCI_FIXUP_FINAL(0x1814, 0x0601, /* Ralink RT2800 802.11n PCI */ + quirk_broken_intx_masking); + DECLARE_PCI_FIXUP_FINAL(0x1b7c, 0x0004, /* Ceton InfiniTV4 */ + quirk_broken_intx_masking); ++DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_20K2, ++ quirk_broken_intx_masking); + + /* + * Realtek RTL8169 PCI Gigabit Ethernet Controller (rev 10) +-- +2.43.0 + diff --git a/queue-6.1/rdma-mad-improve-handling-of-timed-out-wrs-of-mad-ag.patch b/queue-6.1/rdma-mad-improve-handling-of-timed-out-wrs-of-mad-ag.patch new file mode 100644 index 00000000000..aa067540566 --- /dev/null +++ b/queue-6.1/rdma-mad-improve-handling-of-timed-out-wrs-of-mad-ag.patch @@ -0,0 +1,142 @@ +From ac0a87511f6dc3f1103e3947a5924d325a2a2d7b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 22 Jul 2024 16:33:25 +0530 +Subject: RDMA/mad: Improve handling of timed out WRs of mad agent + +From: Saravanan Vajravel + +[ Upstream commit 2a777679b8ccd09a9a65ea0716ef10365179caac ] + +Current timeout handler of mad agent acquires/releases mad_agent_priv +lock for every timed out WRs. This causes heavy locking contention +when higher no. of WRs are to be handled inside timeout handler. + +This leads to softlockup with below trace in some use cases where +rdma-cm path is used to establish connection between peer nodes + +Trace: +----- + BUG: soft lockup - CPU#4 stuck for 26s! [kworker/u128:3:19767] + CPU: 4 PID: 19767 Comm: kworker/u128:3 Kdump: loaded Tainted: G OE + ------- --- 5.14.0-427.13.1.el9_4.x86_64 #1 + Hardware name: Dell Inc. PowerEdge R740/01YM03, BIOS 2.4.8 11/26/2019 + Workqueue: ib_mad1 timeout_sends [ib_core] + RIP: 0010:__do_softirq+0x78/0x2ac + RSP: 0018:ffffb253449e4f98 EFLAGS: 00000246 + RAX: 00000000ffffffff RBX: 0000000000000000 RCX: 000000000000001f + RDX: 000000000000001d RSI: 000000003d1879ab RDI: fff363b66fd3a86b + RBP: ffffb253604cbcd8 R08: 0000009065635f3b R09: 0000000000000000 + R10: 0000000000000040 R11: ffffb253449e4ff8 R12: 0000000000000000 + R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000040 + FS: 0000000000000000(0000) GS:ffff8caa1fc80000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 00007fd9ec9db900 CR3: 0000000891934006 CR4: 00000000007706e0 + DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 + DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 + PKRU: 55555554 + Call Trace: + + ? show_trace_log_lvl+0x1c4/0x2df + ? show_trace_log_lvl+0x1c4/0x2df + ? __irq_exit_rcu+0xa1/0xc0 + ? watchdog_timer_fn+0x1b2/0x210 + ? __pfx_watchdog_timer_fn+0x10/0x10 + ? __hrtimer_run_queues+0x127/0x2c0 + ? hrtimer_interrupt+0xfc/0x210 + ? __sysvec_apic_timer_interrupt+0x5c/0x110 + ? sysvec_apic_timer_interrupt+0x37/0x90 + ? asm_sysvec_apic_timer_interrupt+0x16/0x20 + ? __do_softirq+0x78/0x2ac + ? __do_softirq+0x60/0x2ac + __irq_exit_rcu+0xa1/0xc0 + sysvec_call_function_single+0x72/0x90 + + + asm_sysvec_call_function_single+0x16/0x20 + RIP: 0010:_raw_spin_unlock_irq+0x14/0x30 + RSP: 0018:ffffb253604cbd88 EFLAGS: 00000247 + RAX: 000000000001960d RBX: 0000000000000002 RCX: ffff8cad2a064800 + RDX: 000000008020001b RSI: 0000000000000001 RDI: ffff8cad5d39f66c + RBP: ffff8cad5d39f600 R08: 0000000000000001 R09: 0000000000000000 + R10: ffff8caa443e0c00 R11: ffffb253604cbcd8 R12: ffff8cacb8682538 + R13: 0000000000000005 R14: ffffb253604cbd90 R15: ffff8cad5d39f66c + cm_process_send_error+0x122/0x1d0 [ib_cm] + timeout_sends+0x1dd/0x270 [ib_core] + process_one_work+0x1e2/0x3b0 + ? __pfx_worker_thread+0x10/0x10 + worker_thread+0x50/0x3a0 + ? __pfx_worker_thread+0x10/0x10 + kthread+0xdd/0x100 + ? __pfx_kthread+0x10/0x10 + ret_from_fork+0x29/0x50 + + +Simplified timeout handler by creating local list of timed out WRs +and invoke send handler post creating the list. The new method acquires/ +releases lock once to fetch the list and hence helps to reduce locking +contetiong when processing higher no. of WRs + +Signed-off-by: Saravanan Vajravel +Link: https://lore.kernel.org/r/20240722110325.195085-1-saravanan.vajravel@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/core/mad.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c +index 674344eb8e2f4..58befbaaf0ad5 100644 +--- a/drivers/infiniband/core/mad.c ++++ b/drivers/infiniband/core/mad.c +@@ -2616,14 +2616,16 @@ static int retry_send(struct ib_mad_send_wr_private *mad_send_wr) + + static void timeout_sends(struct work_struct *work) + { ++ struct ib_mad_send_wr_private *mad_send_wr, *n; + struct ib_mad_agent_private *mad_agent_priv; +- struct ib_mad_send_wr_private *mad_send_wr; + struct ib_mad_send_wc mad_send_wc; ++ struct list_head local_list; + unsigned long flags, delay; + + mad_agent_priv = container_of(work, struct ib_mad_agent_private, + timed_work.work); + mad_send_wc.vendor_err = 0; ++ INIT_LIST_HEAD(&local_list); + + spin_lock_irqsave(&mad_agent_priv->lock, flags); + while (!list_empty(&mad_agent_priv->wait_list)) { +@@ -2641,13 +2643,16 @@ static void timeout_sends(struct work_struct *work) + break; + } + +- list_del(&mad_send_wr->agent_list); ++ list_del_init(&mad_send_wr->agent_list); + if (mad_send_wr->status == IB_WC_SUCCESS && + !retry_send(mad_send_wr)) + continue; + +- spin_unlock_irqrestore(&mad_agent_priv->lock, flags); ++ list_add_tail(&mad_send_wr->agent_list, &local_list); ++ } ++ spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + ++ list_for_each_entry_safe(mad_send_wr, n, &local_list, agent_list) { + if (mad_send_wr->status == IB_WC_SUCCESS) + mad_send_wc.status = IB_WC_RESP_TIMEOUT_ERR; + else +@@ -2655,11 +2660,8 @@ static void timeout_sends(struct work_struct *work) + mad_send_wc.send_buf = &mad_send_wr->send_buf; + mad_agent_priv->agent.send_handler(&mad_agent_priv->agent, + &mad_send_wc); +- + deref_mad_agent(mad_agent_priv); +- spin_lock_irqsave(&mad_agent_priv->lock, flags); + } +- spin_unlock_irqrestore(&mad_agent_priv->lock, flags); + } + + /* +-- +2.43.0 + diff --git a/queue-6.1/rdma-mlx5-enforce-umem-boundaries-for-explicit-odp-p.patch b/queue-6.1/rdma-mlx5-enforce-umem-boundaries-for-explicit-odp-p.patch new file mode 100644 index 00000000000..7286b5a8999 --- /dev/null +++ b/queue-6.1/rdma-mlx5-enforce-umem-boundaries-for-explicit-odp-p.patch @@ -0,0 +1,98 @@ +From 68ac737a4bb555586999a88529c9b8163dde4fe7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Sep 2024 13:05:00 +0300 +Subject: RDMA/mlx5: Enforce umem boundaries for explicit ODP page faults + +From: Michael Guralnik + +[ Upstream commit 8c6d097d830f779fc1725fbaa1314f20a7a07b4b ] + +The new memory scheme page faults are requesting the driver to fetch +additinal pages to the faulted memory access. +This is done in order to prefetch pages before and after the area that +got the page fault, assuming this will reduce the total amount of page +faults. + +The driver should ensure it handles only the pages that are within the +umem range. + +Signed-off-by: Michael Guralnik +Link: https://patch.msgid.link/20240909100504.29797-5-michaelgur@nvidia.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/mlx5/odp.c | 25 ++++++++++++++++--------- + 1 file changed, 16 insertions(+), 9 deletions(-) + +diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c +index af73c5ebe6ac5..d3cada2ae5a5b 100644 +--- a/drivers/infiniband/hw/mlx5/odp.c ++++ b/drivers/infiniband/hw/mlx5/odp.c +@@ -734,24 +734,31 @@ static int pagefault_dmabuf_mr(struct mlx5_ib_mr *mr, size_t bcnt, + * >0: Number of pages mapped + */ + static int pagefault_mr(struct mlx5_ib_mr *mr, u64 io_virt, size_t bcnt, +- u32 *bytes_mapped, u32 flags) ++ u32 *bytes_mapped, u32 flags, bool permissive_fault) + { + struct ib_umem_odp *odp = to_ib_umem_odp(mr->umem); + +- if (unlikely(io_virt < mr->ibmr.iova)) ++ if (unlikely(io_virt < mr->ibmr.iova) && !permissive_fault) + return -EFAULT; + + if (mr->umem->is_dmabuf) + return pagefault_dmabuf_mr(mr, bcnt, bytes_mapped, flags); + + if (!odp->is_implicit_odp) { ++ u64 offset = io_virt < mr->ibmr.iova ? 0 : io_virt - mr->ibmr.iova; + u64 user_va; + +- if (check_add_overflow(io_virt - mr->ibmr.iova, +- (u64)odp->umem.address, &user_va)) ++ if (check_add_overflow(offset, (u64)odp->umem.address, ++ &user_va)) + return -EFAULT; +- if (unlikely(user_va >= ib_umem_end(odp) || +- ib_umem_end(odp) - user_va < bcnt)) ++ ++ if (permissive_fault) { ++ if (user_va < ib_umem_start(odp)) ++ user_va = ib_umem_start(odp); ++ if ((user_va + bcnt) > ib_umem_end(odp)) ++ bcnt = ib_umem_end(odp) - user_va; ++ } else if (unlikely(user_va >= ib_umem_end(odp) || ++ ib_umem_end(odp) - user_va < bcnt)) + return -EFAULT; + return pagefault_real_mr(mr, odp, user_va, bcnt, bytes_mapped, + flags); +@@ -858,7 +865,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, + case MLX5_MKEY_MR: + mr = container_of(mmkey, struct mlx5_ib_mr, mmkey); + +- ret = pagefault_mr(mr, io_virt, bcnt, bytes_mapped, 0); ++ ret = pagefault_mr(mr, io_virt, bcnt, bytes_mapped, 0, false); + if (ret < 0) + goto end; + +@@ -1724,7 +1731,7 @@ static void mlx5_ib_prefetch_mr_work(struct work_struct *w) + for (i = 0; i < work->num_sge; ++i) { + ret = pagefault_mr(work->frags[i].mr, work->frags[i].io_virt, + work->frags[i].length, &bytes_mapped, +- work->pf_flags); ++ work->pf_flags, false); + if (ret <= 0) + continue; + mlx5_update_odp_stats(work->frags[i].mr, prefetch, ret); +@@ -1775,7 +1782,7 @@ static int mlx5_ib_prefetch_sg_list(struct ib_pd *pd, + if (IS_ERR(mr)) + return PTR_ERR(mr); + ret = pagefault_mr(mr, sg_list[i].addr, sg_list[i].length, +- &bytes_mapped, pf_flags); ++ &bytes_mapped, pf_flags, false); + if (ret < 0) { + mlx5r_deref_odp_mkey(&mr->mmkey); + return ret; +-- +2.43.0 + diff --git a/queue-6.1/rdma-rtrs-srv-avoid-null-pointer-deref-during-path-e.patch b/queue-6.1/rdma-rtrs-srv-avoid-null-pointer-deref-during-path-e.patch new file mode 100644 index 00000000000..dcfd24e652a --- /dev/null +++ b/queue-6.1/rdma-rtrs-srv-avoid-null-pointer-deref-during-path-e.patch @@ -0,0 +1,66 @@ +From 52361f1e452b4120939116aaac4e2885ac7fa9fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 21 Aug 2024 13:22:14 +0200 +Subject: RDMA/rtrs-srv: Avoid null pointer deref during path establishment + +From: Md Haris Iqbal + +[ Upstream commit d0e62bf7b575fbfe591f6f570e7595dd60a2f5eb ] + +For RTRS path establishment, RTRS client initiates and completes con_num +of connections. After establishing all its connections, the information +is exchanged between the client and server through the info_req message. +During this exchange, it is essential that all connections have been +established, and the state of the RTRS srv path is CONNECTED. + +So add these sanity checks, to make sure we detect and abort process in +error scenarios to avoid null pointer deref. + +Signed-off-by: Md Haris Iqbal +Signed-off-by: Jack Wang +Signed-off-by: Grzegorz Prajsner +Link: https://patch.msgid.link/20240821112217.41827-9-haris.iqbal@ionos.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/rtrs/rtrs-srv.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +index 726b690ebe652..a70ccb4d4c857 100644 +--- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c ++++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c +@@ -936,12 +936,11 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, struct ib_wc *wc) + if (err) + goto close; + +-out: + rtrs_iu_free(iu, srv_path->s.dev->ib_dev, 1); + return; + close: ++ rtrs_iu_free(iu, srv_path->s.dev->ib_dev, 1); + close_path(srv_path); +- goto out; + } + + static int post_recv_info_req(struct rtrs_srv_con *con) +@@ -992,6 +991,16 @@ static int post_recv_path(struct rtrs_srv_path *srv_path) + q_size = SERVICE_CON_QUEUE_DEPTH; + else + q_size = srv->queue_depth; ++ if (srv_path->state != RTRS_SRV_CONNECTING) { ++ rtrs_err(s, "Path state invalid. state %s\n", ++ rtrs_srv_state_str(srv_path->state)); ++ return -EIO; ++ } ++ ++ if (!srv_path->s.con[cid]) { ++ rtrs_err(s, "Conn not set for %d\n", cid); ++ return -EIO; ++ } + + err = post_recv_io(to_srv_con(srv_path->s.con[cid]), q_size); + if (err) { +-- +2.43.0 + diff --git a/queue-6.1/remoteproc-imx_rproc-use-imx-specific-hook-for-find_.patch b/queue-6.1/remoteproc-imx_rproc-use-imx-specific-hook-for-find_.patch new file mode 100644 index 00000000000..70e822f67d2 --- /dev/null +++ b/queue-6.1/remoteproc-imx_rproc-use-imx-specific-hook-for-find_.patch @@ -0,0 +1,69 @@ +From c679438a0ffa65c94096a485f2ff1ee96f75d8df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 19 Jul 2024 16:36:12 +0800 +Subject: remoteproc: imx_rproc: Use imx specific hook for + find_loaded_rsc_table + +From: Peng Fan + +[ Upstream commit e954a1bd16102abc800629f9900715d8ec4c3130 ] + +If there is a resource table device tree node, use the address as +the resource table address, otherwise use the address(where +.resource_table section loaded) inside the Cortex-M elf file. + +And there is an update in NXP SDK that Resource Domain Control(RDC) +enabled to protect TCM, linux not able to write the TCM space when +updating resource table status and cause kernel dump. So use the address +from device tree could avoid kernel dump. + +Note: NXP M4 SDK not check resource table update, so it does not matter +use whether resource table address specified in elf file or in device +tree. But to reflect the fact that if people specific resource table +address in device tree, it means people are aware and going to use it, +not the address specified in elf file. + +Reviewed-by: Iuliana Prodan +Signed-off-by: Peng Fan +Reviewed-by: Daniel Baluta +Link: https://lore.kernel.org/r/20240719-imx_rproc-v2-2-10d0268c7eb1@nxp.com +Signed-off-by: Mathieu Poirier +Signed-off-by: Sasha Levin +--- + drivers/remoteproc/imx_rproc.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c +index 00a0c8f4a2200..bbaba453383dd 100644 +--- a/drivers/remoteproc/imx_rproc.c ++++ b/drivers/remoteproc/imx_rproc.c +@@ -537,6 +537,17 @@ static struct resource_table *imx_rproc_get_loaded_rsc_table(struct rproc *rproc + return (struct resource_table *)priv->rsc_table; + } + ++static struct resource_table * ++imx_rproc_elf_find_loaded_rsc_table(struct rproc *rproc, const struct firmware *fw) ++{ ++ struct imx_rproc *priv = rproc->priv; ++ ++ if (priv->rsc_table) ++ return (struct resource_table *)priv->rsc_table; ++ ++ return rproc_elf_find_loaded_rsc_table(rproc, fw); ++} ++ + static const struct rproc_ops imx_rproc_ops = { + .prepare = imx_rproc_prepare, + .attach = imx_rproc_attach, +@@ -546,7 +557,7 @@ static const struct rproc_ops imx_rproc_ops = { + .da_to_va = imx_rproc_da_to_va, + .load = rproc_elf_load_segments, + .parse_fw = imx_rproc_parse_fw, +- .find_loaded_rsc_table = rproc_elf_find_loaded_rsc_table, ++ .find_loaded_rsc_table = imx_rproc_elf_find_loaded_rsc_table, + .get_loaded_rsc_table = imx_rproc_get_loaded_rsc_table, + .sanity_check = rproc_elf_sanity_check, + .get_boot_addr = rproc_elf_get_boot_addr, +-- +2.43.0 + diff --git a/queue-6.1/risc-v-don-t-have-max_physmem_bits-exceed-phys_addr_.patch b/queue-6.1/risc-v-don-t-have-max_physmem_bits-exceed-phys_addr_.patch new file mode 100644 index 00000000000..b35cc442b44 --- /dev/null +++ b/queue-6.1/risc-v-don-t-have-max_physmem_bits-exceed-phys_addr_.patch @@ -0,0 +1,70 @@ +From 4ec1ad4ac064678f564cd44a65df49723eeb27d4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2024 09:22:00 -0700 +Subject: RISC-V: Don't have MAX_PHYSMEM_BITS exceed phys_addr_t + +From: Palmer Dabbelt + +[ Upstream commit ad380f6a0a5e82e794b45bb2eaec24ed51a56846 ] + +I recently ended up with a warning on some compilers along the lines of + + CC kernel/resource.o + In file included from include/linux/ioport.h:16, + from kernel/resource.c:15: + kernel/resource.c: In function 'gfr_start': + include/linux/minmax.h:49:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '17179869183' to '4294967295' [-Werror=overflow] + 49 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) + | ^ + include/linux/minmax.h:52:9: note: in expansion of macro '__cmp_once_unique' + 52 | __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) + | ^~~~~~~~~~~~~~~~~ + include/linux/minmax.h:161:27: note: in expansion of macro '__cmp_once' + 161 | #define min_t(type, x, y) __cmp_once(min, type, x, y) + | ^~~~~~~~~~ + kernel/resource.c:1829:23: note: in expansion of macro 'min_t' + 1829 | end = min_t(resource_size_t, base->end, + | ^~~~~ + kernel/resource.c: In function 'gfr_continue': + include/linux/minmax.h:49:37: error: conversion from 'long long unsigned int' to 'resource_size_t' {aka 'unsigned int'} changes value from '17179869183' to '4294967295' [-Werror=overflow] + 49 | ({ type ux = (x); type uy = (y); __cmp(op, ux, uy); }) + | ^ + include/linux/minmax.h:52:9: note: in expansion of macro '__cmp_once_unique' + 52 | __cmp_once_unique(op, type, x, y, __UNIQUE_ID(x_), __UNIQUE_ID(y_)) + | ^~~~~~~~~~~~~~~~~ + include/linux/minmax.h:161:27: note: in expansion of macro '__cmp_once' + 161 | #define min_t(type, x, y) __cmp_once(min, type, x, y) + | ^~~~~~~~~~ + kernel/resource.c:1847:24: note: in expansion of macro 'min_t' + 1847 | addr <= min_t(resource_size_t, base->end, + | ^~~~~ + cc1: all warnings being treated as errors + +which looks like a real problem: our phys_addr_t is only 32 bits now, so +having 34-bit masks is just going to result in overflows. + +Reviewed-by: Charlie Jenkins +Reviewed-by: Alexandre Ghiti +Link: https://lore.kernel.org/r/20240731162159.9235-2-palmer@rivosinc.com +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/include/asm/sparsemem.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/riscv/include/asm/sparsemem.h b/arch/riscv/include/asm/sparsemem.h +index 63acaecc33747..2f901a410586d 100644 +--- a/arch/riscv/include/asm/sparsemem.h ++++ b/arch/riscv/include/asm/sparsemem.h +@@ -7,7 +7,7 @@ + #ifdef CONFIG_64BIT + #define MAX_PHYSMEM_BITS 56 + #else +-#define MAX_PHYSMEM_BITS 34 ++#define MAX_PHYSMEM_BITS 32 + #endif /* CONFIG_64BIT */ + #define SECTION_SIZE_BITS 27 + #endif /* CONFIG_SPARSEMEM */ +-- +2.43.0 + diff --git a/queue-6.1/riscv-kexec_file-fix-relocation-type-r_riscv_add16-a.patch b/queue-6.1/riscv-kexec_file-fix-relocation-type-r_riscv_add16-a.patch new file mode 100644 index 00000000000..f1f4061a0de --- /dev/null +++ b/queue-6.1/riscv-kexec_file-fix-relocation-type-r_riscv_add16-a.patch @@ -0,0 +1,57 @@ +From f74c73596da5d6ee14428778621e248d04135c55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 11 Jul 2024 08:32:36 +0000 +Subject: riscv/kexec_file: Fix relocation type R_RISCV_ADD16 and R_RISCV_SUB16 + unknown + +From: Ying Sun + +[ Upstream commit c6ebf2c528470a09be77d0d9df2c6617ea037ac5 ] + +Runs on the kernel with CONFIG_RISCV_ALTERNATIVE enabled: + kexec -sl vmlinux + +Error: + kexec_image: Unknown rela relocation: 34 + kexec_image: Error loading purgatory ret=-8 +and + kexec_image: Unknown rela relocation: 38 + kexec_image: Error loading purgatory ret=-8 + +The purgatory code uses the 16-bit addition and subtraction relocation +type, but not handled, resulting in kexec_file_load failure. +So add handle to arch_kexec_apply_relocations_add(). + +Tested on RISC-V64 Qemu-virt, issue fixed. + +Co-developed-by: Petr Tesarik +Signed-off-by: Petr Tesarik +Signed-off-by: Ying Sun +Reviewed-by: Andrew Jones +Link: https://lore.kernel.org/r/20240711083236.2859632-1-sunying@isrc.iscas.ac.cn +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/kernel/elf_kexec.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/arch/riscv/kernel/elf_kexec.c b/arch/riscv/kernel/elf_kexec.c +index b3b96ff46d193..88721bea81fcd 100644 +--- a/arch/riscv/kernel/elf_kexec.c ++++ b/arch/riscv/kernel/elf_kexec.c +@@ -444,6 +444,12 @@ int arch_kexec_apply_relocations_add(struct purgatory_info *pi, + *(u32 *)loc = CLEAN_IMM(CJTYPE, *(u32 *)loc) | + ENCODE_CJTYPE_IMM(val - addr); + break; ++ case R_RISCV_ADD16: ++ *(u16 *)loc += val; ++ break; ++ case R_RISCV_SUB16: ++ *(u16 *)loc -= val; ++ break; + case R_RISCV_ADD32: + *(u32 *)loc += val; + break; +-- +2.43.0 + diff --git a/queue-6.1/s390-boot-compile-all-files-with-the-same-march-flag.patch b/queue-6.1/s390-boot-compile-all-files-with-the-same-march-flag.patch new file mode 100644 index 00000000000..33854f1fef6 --- /dev/null +++ b/queue-6.1/s390-boot-compile-all-files-with-the-same-march-flag.patch @@ -0,0 +1,66 @@ +From dccf60f50cbed78db8f8fdf30f57fa4041d7ca7f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Sep 2024 11:39:27 +0200 +Subject: s390/boot: Compile all files with the same march flag + +From: Heiko Carstens + +[ Upstream commit fccb175bc89a0d37e3ff513bb6bf1f73b3a48950 ] + +Only a couple of files of the decompressor are compiled with the +minimum architecture level. This is problematic for potential function +calls between compile units, especially if a target function is within +a compile until compiled for a higher architecture level, since that +may lead to an unexpected operation exception. + +Therefore compile all files of the decompressor for the same (minimum) +architecture level. + +Reviewed-by: Sven Schnelle +Signed-off-by: Heiko Carstens +Signed-off-by: Sasha Levin +--- + arch/s390/boot/Makefile | 19 +++++-------------- + 1 file changed, 5 insertions(+), 14 deletions(-) + +diff --git a/arch/s390/boot/Makefile b/arch/s390/boot/Makefile +index d52c3e2e16bc5..a010491585e88 100644 +--- a/arch/s390/boot/Makefile ++++ b/arch/s390/boot/Makefile +@@ -9,11 +9,8 @@ UBSAN_SANITIZE := n + KASAN_SANITIZE := n + KCSAN_SANITIZE := n + +-KBUILD_AFLAGS := $(KBUILD_AFLAGS_DECOMPRESSOR) +-KBUILD_CFLAGS := $(KBUILD_CFLAGS_DECOMPRESSOR) +- + # +-# Use minimum architecture for als.c to be able to print an error ++# Use minimum architecture level so it is possible to print an error + # message if the kernel is started on a machine which is too old + # + ifndef CONFIG_CC_IS_CLANG +@@ -22,16 +19,10 @@ else + CC_FLAGS_MARCH_MINIMUM := -march=z10 + endif + +-ifneq ($(CC_FLAGS_MARCH),$(CC_FLAGS_MARCH_MINIMUM)) +-AFLAGS_REMOVE_head.o += $(CC_FLAGS_MARCH) +-AFLAGS_head.o += $(CC_FLAGS_MARCH_MINIMUM) +-AFLAGS_REMOVE_mem.o += $(CC_FLAGS_MARCH) +-AFLAGS_mem.o += $(CC_FLAGS_MARCH_MINIMUM) +-CFLAGS_REMOVE_als.o += $(CC_FLAGS_MARCH) +-CFLAGS_als.o += $(CC_FLAGS_MARCH_MINIMUM) +-CFLAGS_REMOVE_sclp_early_core.o += $(CC_FLAGS_MARCH) +-CFLAGS_sclp_early_core.o += $(CC_FLAGS_MARCH_MINIMUM) +-endif ++KBUILD_AFLAGS := $(filter-out $(CC_FLAGS_MARCH),$(KBUILD_AFLAGS_DECOMPRESSOR)) ++KBUILD_CFLAGS := $(filter-out $(CC_FLAGS_MARCH),$(KBUILD_CFLAGS_DECOMPRESSOR)) ++KBUILD_AFLAGS += $(CC_FLAGS_MARCH_MINIMUM) ++KBUILD_CFLAGS += $(CC_FLAGS_MARCH_MINIMUM) + + CFLAGS_sclp_early_core.o += -I$(srctree)/drivers/s390/char + +-- +2.43.0 + diff --git a/queue-6.1/s390-cpum_sf-remove-warn_on_once-statements.patch b/queue-6.1/s390-cpum_sf-remove-warn_on_once-statements.patch new file mode 100644 index 00000000000..87e369a78f8 --- /dev/null +++ b/queue-6.1/s390-cpum_sf-remove-warn_on_once-statements.patch @@ -0,0 +1,71 @@ +From 70cc8d039697e8158f9520fb238703b8d541ec0c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 10 Jul 2024 12:23:47 +0200 +Subject: s390/cpum_sf: Remove WARN_ON_ONCE statements + +From: Thomas Richter + +[ Upstream commit b495e710157606889f2d8bdc62aebf2aa02f67a7 ] + +Remove WARN_ON_ONCE statements. These have not triggered in the +past. + +Signed-off-by: Thomas Richter +Acked-by: Sumanth Korikkar +Cc: Heiko Carstens +Cc: Vasily Gorbik +Cc: Alexander Gordeev +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/perf_cpum_sf.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c +index ce886a03545ae..f3b0a106f7227 100644 +--- a/arch/s390/kernel/perf_cpum_sf.c ++++ b/arch/s390/kernel/perf_cpum_sf.c +@@ -1432,7 +1432,7 @@ static int aux_output_begin(struct perf_output_handle *handle, + unsigned long head, base, offset; + struct hws_trailer_entry *te; + +- if (WARN_ON_ONCE(handle->head & ~PAGE_MASK)) ++ if (handle->head & ~PAGE_MASK) + return -EINVAL; + + aux->head = handle->head >> PAGE_SHIFT; +@@ -1613,7 +1613,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) + unsigned long num_sdb; + + aux = perf_get_aux(handle); +- if (WARN_ON_ONCE(!aux)) ++ if (!aux) + return; + + /* Inform user space new data arrived */ +@@ -1635,7 +1635,7 @@ static void hw_collect_aux(struct cpu_hw_sf *cpuhw) + __func__); + break; + } +- if (WARN_ON_ONCE(!aux)) ++ if (!aux) + return; + + /* Update head and alert_mark to new position */ +@@ -1870,12 +1870,8 @@ static void cpumsf_pmu_start(struct perf_event *event, int flags) + { + struct cpu_hw_sf *cpuhw = this_cpu_ptr(&cpu_hw_sf); + +- if (WARN_ON_ONCE(!(event->hw.state & PERF_HES_STOPPED))) ++ if (!(event->hw.state & PERF_HES_STOPPED)) + return; +- +- if (flags & PERF_EF_RELOAD) +- WARN_ON_ONCE(!(event->hw.state & PERF_HES_UPTODATE)); +- + perf_pmu_disable(event->pmu); + event->hw.state = 0; + cpuhw->lsctl.cs = 1; +-- +2.43.0 + diff --git a/queue-6.1/s390-facility-disable-compile-time-optimization-for-.patch b/queue-6.1/s390-facility-disable-compile-time-optimization-for-.patch new file mode 100644 index 00000000000..27f5d33ab0e --- /dev/null +++ b/queue-6.1/s390-facility-disable-compile-time-optimization-for-.patch @@ -0,0 +1,45 @@ +From 6f925b975131b1f14f6a66d11ba3280b7d0e4bf1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Sep 2024 11:39:24 +0200 +Subject: s390/facility: Disable compile time optimization for decompressor + code + +From: Heiko Carstens + +[ Upstream commit 0147addc4fb72a39448b8873d8acdf3a0f29aa65 ] + +Disable compile time optimizations of test_facility() for the +decompressor. The decompressor should not contain any optimized code +depending on the architecture level set the kernel image is compiled +for to avoid unexpected operation exceptions. + +Add a __DECOMPRESSOR check to test_facility() to enforce that +facilities are always checked during runtime for the decompressor. + +Reviewed-by: Sven Schnelle +Signed-off-by: Heiko Carstens +Signed-off-by: Sasha Levin +--- + arch/s390/include/asm/facility.h | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/include/asm/facility.h b/arch/s390/include/asm/facility.h +index 94b6919026dfb..953d42205ea83 100644 +--- a/arch/s390/include/asm/facility.h ++++ b/arch/s390/include/asm/facility.h +@@ -60,8 +60,10 @@ static inline int test_facility(unsigned long nr) + unsigned long facilities_als[] = { FACILITIES_ALS }; + + if (__builtin_constant_p(nr) && nr < sizeof(facilities_als) * 8) { +- if (__test_facility(nr, &facilities_als)) +- return 1; ++ if (__test_facility(nr, &facilities_als)) { ++ if (!__is_defined(__DECOMPRESSOR)) ++ return 1; ++ } + } + return __test_facility(nr, &stfle_fac_list); + } +-- +2.43.0 + diff --git a/queue-6.1/s390-mm-add-cond_resched-to-cmm_alloc-free_pages.patch b/queue-6.1/s390-mm-add-cond_resched-to-cmm_alloc-free_pages.patch new file mode 100644 index 00000000000..0adbfbcc338 --- /dev/null +++ b/queue-6.1/s390-mm-add-cond_resched-to-cmm_alloc-free_pages.patch @@ -0,0 +1,69 @@ +From f05db114df96037474fcea702d7f63df1afe8a6c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Sep 2024 14:02:19 +0200 +Subject: s390/mm: Add cond_resched() to cmm_alloc/free_pages() + +From: Gerald Schaefer + +[ Upstream commit 131b8db78558120f58c5dc745ea9655f6b854162 ] + +Adding/removing large amount of pages at once to/from the CMM balloon +can result in rcu_sched stalls or workqueue lockups, because of busy +looping w/o cond_resched(). + +Prevent this by adding a cond_resched(). cmm_free_pages() holds a +spin_lock while looping, so it cannot be added directly to the existing +loop. Instead, introduce a wrapper function that operates on maximum 256 +pages at once, and add it there. + +Signed-off-by: Gerald Schaefer +Reviewed-by: Heiko Carstens +Signed-off-by: Heiko Carstens +Signed-off-by: Sasha Levin +--- + arch/s390/mm/cmm.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/arch/s390/mm/cmm.c b/arch/s390/mm/cmm.c +index 9141ed4c52e90..02e030ad38c5f 100644 +--- a/arch/s390/mm/cmm.c ++++ b/arch/s390/mm/cmm.c +@@ -95,11 +95,12 @@ static long cmm_alloc_pages(long nr, long *counter, + (*counter)++; + spin_unlock(&cmm_lock); + nr--; ++ cond_resched(); + } + return nr; + } + +-static long cmm_free_pages(long nr, long *counter, struct cmm_page_array **list) ++static long __cmm_free_pages(long nr, long *counter, struct cmm_page_array **list) + { + struct cmm_page_array *pa; + unsigned long addr; +@@ -123,6 +124,21 @@ static long cmm_free_pages(long nr, long *counter, struct cmm_page_array **list) + return nr; + } + ++static long cmm_free_pages(long nr, long *counter, struct cmm_page_array **list) ++{ ++ long inc = 0; ++ ++ while (nr) { ++ inc = min(256L, nr); ++ nr -= inc; ++ inc = __cmm_free_pages(inc, counter, list); ++ if (inc) ++ break; ++ cond_resched(); ++ } ++ return nr + inc; ++} ++ + static int cmm_oom_notify(struct notifier_block *self, + unsigned long dummy, void *parm) + { +-- +2.43.0 + diff --git a/queue-6.1/s390-traps-handle-early-warnings-gracefully.patch b/queue-6.1/s390-traps-handle-early-warnings-gracefully.patch new file mode 100644 index 00000000000..2ccab3a1c47 --- /dev/null +++ b/queue-6.1/s390-traps-handle-early-warnings-gracefully.patch @@ -0,0 +1,56 @@ +From 73ea89aa88b5f93e3e0a1270f2e52b4c801d5b45 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 31 Jul 2024 15:26:01 +0200 +Subject: s390/traps: Handle early warnings gracefully + +From: Heiko Carstens + +[ Upstream commit 3c4d0ae0671827f4b536cc2d26f8b9c54584ccc5 ] + +Add missing warning handling to the early program check handler. This +way a warning is printed to the console as soon as the early console +is setup, and the kernel continues to boot. + +Before this change a disabled wait psw was loaded instead and the +machine was silently stopped without giving an idea about what +happened. + +Reviewed-by: Sven Schnelle +Signed-off-by: Heiko Carstens +Signed-off-by: Vasily Gorbik +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/early.c | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c +index b3cb256ec6692..1dcdce60b89c7 100644 +--- a/arch/s390/kernel/early.c ++++ b/arch/s390/kernel/early.c +@@ -151,8 +151,21 @@ static __init void setup_topology(void) + + void __do_early_pgm_check(struct pt_regs *regs) + { +- if (!fixup_exception(regs)) +- disabled_wait(); ++ struct lowcore *lc = get_lowcore(); ++ unsigned long ip; ++ ++ regs->int_code = lc->pgm_int_code; ++ regs->int_parm_long = lc->trans_exc_code; ++ ip = __rewind_psw(regs->psw, regs->int_code >> 16); ++ ++ /* Monitor Event? Might be a warning */ ++ if ((regs->int_code & PGM_INT_CODE_MASK) == 0x40) { ++ if (report_bug(ip, regs) == BUG_TRAP_TYPE_WARN) ++ return; ++ } ++ if (fixup_exception(regs)) ++ return; ++ disabled_wait(); + } + + static noinline __init void setup_lowcore_early(void) +-- +2.43.0 + diff --git a/queue-6.1/scsi-lpfc-add-els_rsp-cmd-to-the-list-of-wqes-to-flu.patch b/queue-6.1/scsi-lpfc-add-els_rsp-cmd-to-the-list-of-wqes-to-flu.patch new file mode 100644 index 00000000000..e3d1b420f80 --- /dev/null +++ b/queue-6.1/scsi-lpfc-add-els_rsp-cmd-to-the-list-of-wqes-to-flu.patch @@ -0,0 +1,55 @@ +From 0a3a17add38f5ffb406cfa74303d92d2fba2650b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Sep 2024 16:24:40 -0700 +Subject: scsi: lpfc: Add ELS_RSP cmd to the list of WQEs to flush in + lpfc_els_flush_cmd() + +From: Justin Tee + +[ Upstream commit 93bcc5f3984bf4f51da1529700aec351872dbfff ] + +During HBA stress testing, a spam of received PLOGIs exposes a resource +recovery bug causing leakage of lpfc_sqlq entries from the global +phba->sli4_hba.lpfc_els_sgl_list. + +The issue is in lpfc_els_flush_cmd(), where the driver attempts to recover +outstanding ELS sgls when walking the txcmplq. Only CMD_ELS_REQUEST64_CRs +and CMD_GEN_REQUEST64_CRs are added to the abort and cancel lists. A check +for CMD_XMIT_ELS_RSP64_WQE is missing in order to recover LS_ACC usages of +the phba->sli4_hba.lpfc_els_sgl_list too. + +Fix by adding CMD_XMIT_ELS_RSP64_WQE as part of the txcmplq walk when +adding WQEs to the abort and cancel list in lpfc_els_flush_cmd(). Also, +update naming convention from CRs to WQEs. + +Signed-off-by: Justin Tee +Link: https://lore.kernel.org/r/20240912232447.45607-2-justintee8345@gmail.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_els.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c +index a8dd142e832a0..b4afaed5e4879 100644 +--- a/drivers/scsi/lpfc/lpfc_els.c ++++ b/drivers/scsi/lpfc/lpfc_els.c +@@ -9455,11 +9455,12 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) + if (piocb->cmd_flag & LPFC_DRIVER_ABORTED && !mbx_tmo_err) + continue; + +- /* On the ELS ring we can have ELS_REQUESTs or +- * GEN_REQUESTs waiting for a response. ++ /* On the ELS ring we can have ELS_REQUESTs, ELS_RSPs, ++ * or GEN_REQUESTs waiting for a CQE response. + */ + ulp_command = get_job_cmnd(phba, piocb); +- if (ulp_command == CMD_ELS_REQUEST64_CR) { ++ if (ulp_command == CMD_ELS_REQUEST64_WQE || ++ ulp_command == CMD_XMIT_ELS_RSP64_WQE) { + list_add_tail(&piocb->dlist, &abort_list); + + /* If the link is down when flushing ELS commands +-- +2.43.0 + diff --git a/queue-6.1/scsi-lpfc-ensure-da_id-handling-completion-before-de.patch b/queue-6.1/scsi-lpfc-ensure-da_id-handling-completion-before-de.patch new file mode 100644 index 00000000000..2b1c943b65e --- /dev/null +++ b/queue-6.1/scsi-lpfc-ensure-da_id-handling-completion-before-de.patch @@ -0,0 +1,146 @@ +From b3a9302baab5fffecfade9cb1bc28bae45050541 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Sep 2024 16:24:44 -0700 +Subject: scsi: lpfc: Ensure DA_ID handling completion before deleting an NPIV + instance + +From: Justin Tee + +[ Upstream commit 0a3c84f71680684c1d41abb92db05f95c09111e8 ] + +Deleting an NPIV instance requires all fabric ndlps to be released before +an NPIV's resources can be torn down. Failure to release fabric ndlps +beforehand opens kref imbalance race conditions. Fix by forcing the DA_ID +to complete synchronously with usage of wait_queue. + +Signed-off-by: Justin Tee +Link: https://lore.kernel.org/r/20240912232447.45607-6-justintee8345@gmail.com +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/lpfc/lpfc_ct.c | 12 ++++++++++ + drivers/scsi/lpfc/lpfc_disc.h | 7 ++++++ + drivers/scsi/lpfc/lpfc_vport.c | 43 ++++++++++++++++++++++++++++------ + 3 files changed, 55 insertions(+), 7 deletions(-) + +diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c +index e941a99aa9659..8006b0eea3fbd 100644 +--- a/drivers/scsi/lpfc/lpfc_ct.c ++++ b/drivers/scsi/lpfc/lpfc_ct.c +@@ -1663,6 +1663,18 @@ lpfc_cmpl_ct(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, + } + + out: ++ /* If the caller wanted a synchronous DA_ID completion, signal the ++ * wait obj and clear flag to reset the vport. ++ */ ++ if (ndlp->save_flags & NLP_WAIT_FOR_DA_ID) { ++ if (ndlp->da_id_waitq) ++ wake_up(ndlp->da_id_waitq); ++ } ++ ++ spin_lock_irq(&ndlp->lock); ++ ndlp->save_flags &= ~NLP_WAIT_FOR_DA_ID; ++ spin_unlock_irq(&ndlp->lock); ++ + lpfc_ct_free_iocb(phba, cmdiocb); + lpfc_nlp_put(ndlp); + return; +diff --git a/drivers/scsi/lpfc/lpfc_disc.h b/drivers/scsi/lpfc/lpfc_disc.h +index f82615d87c4bb..f5ae8cc158205 100644 +--- a/drivers/scsi/lpfc/lpfc_disc.h ++++ b/drivers/scsi/lpfc/lpfc_disc.h +@@ -90,6 +90,8 @@ enum lpfc_nlp_save_flags { + NLP_IN_RECOV_POST_DEV_LOSS = 0x1, + /* wait for outstanding LOGO to cmpl */ + NLP_WAIT_FOR_LOGO = 0x2, ++ /* wait for outstanding DA_ID to finish */ ++ NLP_WAIT_FOR_DA_ID = 0x4 + }; + + struct lpfc_nodelist { +@@ -159,7 +161,12 @@ struct lpfc_nodelist { + uint32_t nvme_fb_size; /* NVME target's supported byte cnt */ + #define NVME_FB_BIT_SHIFT 9 /* PRLI Rsp first burst in 512B units. */ + uint32_t nlp_defer_did; ++ ++ /* These wait objects are NPIV specific. These IOs must complete ++ * synchronously. ++ */ + wait_queue_head_t *logo_waitq; ++ wait_queue_head_t *da_id_waitq; + }; + + struct lpfc_node_rrq { +diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c +index 6b4259894584f..fe7c3064c097a 100644 +--- a/drivers/scsi/lpfc/lpfc_vport.c ++++ b/drivers/scsi/lpfc/lpfc_vport.c +@@ -643,6 +643,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport) + struct Scsi_Host *shost = lpfc_shost_from_vport(vport); + struct lpfc_hba *phba = vport->phba; + int rc; ++ DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq); + + if (vport->port_type == LPFC_PHYSICAL_PORT) { + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, +@@ -698,21 +699,49 @@ lpfc_vport_delete(struct fc_vport *fc_vport) + if (!ndlp) + goto skip_logo; + ++ /* Send the DA_ID and Fabric LOGO to cleanup the NPIV fabric entries. */ + if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && + phba->link_state >= LPFC_LINK_UP && + phba->fc_topology != LPFC_TOPOLOGY_LOOP) { + if (vport->cfg_enable_da_id) { +- /* Send DA_ID and wait for a completion. */ ++ /* Send DA_ID and wait for a completion. This is best ++ * effort. If the DA_ID fails, likely the fabric will ++ * "leak" NportIDs but at least the driver issued the ++ * command. ++ */ ++ ndlp = lpfc_findnode_did(vport, NameServer_DID); ++ if (!ndlp) ++ goto issue_logo; ++ ++ spin_lock_irq(&ndlp->lock); ++ ndlp->da_id_waitq = &waitq; ++ ndlp->save_flags |= NLP_WAIT_FOR_DA_ID; ++ spin_unlock_irq(&ndlp->lock); ++ + rc = lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0); +- if (rc) { +- lpfc_printf_log(vport->phba, KERN_WARNING, +- LOG_VPORT, +- "1829 CT command failed to " +- "delete objects on fabric, " +- "rc %d\n", rc); ++ if (!rc) { ++ wait_event_timeout(waitq, ++ !(ndlp->save_flags & NLP_WAIT_FOR_DA_ID), ++ msecs_to_jiffies(phba->fc_ratov * 2000)); + } ++ ++ lpfc_printf_vlog(vport, KERN_INFO, LOG_VPORT | LOG_ELS, ++ "1829 DA_ID issue status %d. " ++ "SFlag x%x NState x%x, NFlag x%x " ++ "Rpi x%x\n", ++ rc, ndlp->save_flags, ndlp->nlp_state, ++ ndlp->nlp_flag, ndlp->nlp_rpi); ++ ++ /* Remove the waitq and save_flags. It no ++ * longer matters if the wake happened. ++ */ ++ spin_lock_irq(&ndlp->lock); ++ ndlp->da_id_waitq = NULL; ++ ndlp->save_flags &= ~NLP_WAIT_FOR_DA_ID; ++ spin_unlock_irq(&ndlp->lock); + } + ++issue_logo: + /* + * If the vpi is not registered, then a valid FDISC doesn't + * exist and there is no need for a ELS LOGO. Just cleanup +-- +2.43.0 + diff --git a/queue-6.1/series b/queue-6.1/series index f5cb2e407c6..9f2dacb5763 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -684,3 +684,42 @@ fs-ntfs3-fix-sparse-warning-in-ni_fiemap.patch fs-ntfs3-refactor-enum_rstbl-to-suppress-static-chec.patch virtio_console-fix-misc-probe-bugs.patch input-synaptics-rmi4-fix-uaf-of-irq-domain-on-driver.patch +bpf-check-percpu-map-value-size-first.patch +s390-boot-compile-all-files-with-the-same-march-flag.patch +s390-facility-disable-compile-time-optimization-for-.patch +s390-mm-add-cond_resched-to-cmm_alloc-free_pages.patch +bpf-x64-fix-a-jit-convergence-issue.patch +ext4-don-t-set-sb_rdonly-after-filesystem-errors.patch +ext4-nested-locking-for-xattr-inode.patch +s390-cpum_sf-remove-warn_on_once-statements.patch +s390-traps-handle-early-warnings-gracefully.patch +ktest.pl-avoid-false-positives-with-grub2-skip-regex.patch +rdma-mad-improve-handling-of-timed-out-wrs-of-mad-ag.patch +pci-add-function-0-dma-alias-quirk-for-glenfly-arise.patch +rdma-rtrs-srv-avoid-null-pointer-deref-during-path-e.patch +clk-bcm-bcm53573-fix-of-node-leak-in-init.patch +pci-add-acs-quirk-for-qualcomm-sa8775p.patch +i2c-i801-use-a-different-adapter-name-for-idf-adapte.patch +pci-mark-creative-labs-emu20k2-intx-masking-as-broke.patch +risc-v-don-t-have-max_physmem_bits-exceed-phys_addr_.patch +io_uring-check-if-we-need-to-reschedule-during-overf.patch +ntb-ntb_hw_switchtec-fix-use-after-free-vulnerabilit.patch +rdma-mlx5-enforce-umem-boundaries-for-explicit-odp-p.patch +riscv-kexec_file-fix-relocation-type-r_riscv_add16-a.patch +media-videobuf2-core-clear-memory-related-fields-in-.patch +remoteproc-imx_rproc-use-imx-specific-hook-for-find_.patch +clk-imx-remove-clk_set_parent_gate-for-dram-mux-for-.patch +usb-chipidea-udc-enable-suspend-interrupt-after-usb-.patch +usb-dwc2-adjust-the-timing-of-usb-driver-interrupt-r.patch +comedi-ni_routing-tools-check-when-the-file-could-no.patch +loongarch-fix-memleak-in-pci_acpi_scan_root.patch +netfilter-nf_reject-fix-build-warning-when-config_br.patch +virtio_pmem-check-device-status-before-requesting-fl.patch +tools-iio-add-memory-allocation-failure-check-for-tr.patch +staging-vme_user-added-bound-check-to-geoid.patch +driver-core-bus-return-eio-instead-of-0-when-show-st.patch +scsi-lpfc-add-els_rsp-cmd-to-the-list-of-wqes-to-flu.patch +scsi-lpfc-ensure-da_id-handling-completion-before-de.patch +drm-amd-display-check-null-pointer-before-dereferenc.patch +fbcon-fix-a-null-pointer-dereference-issue-in-fbcon_.patch +fbdev-sisfb-fix-strbuf-array-overflow.patch diff --git a/queue-6.1/staging-vme_user-added-bound-check-to-geoid.patch b/queue-6.1/staging-vme_user-added-bound-check-to-geoid.patch new file mode 100644 index 00000000000..96a1b284345 --- /dev/null +++ b/queue-6.1/staging-vme_user-added-bound-check-to-geoid.patch @@ -0,0 +1,60 @@ +From 3eb5c75414a7e77d6b1cb8468aa78f1cb02b9b75 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Aug 2024 18:26:05 +0530 +Subject: staging: vme_user: added bound check to geoid + +From: Riyan Dhiman + +[ Upstream commit a8a8b54350229f59c8ba6496fb5689a1632a59be ] + +The geoid is a module parameter that allows users to hardcode the slot number. +A bound check for geoid was added in the probe function because only values +between 0 and less than VME_MAX_SLOT are valid. + +Signed-off-by: Riyan Dhiman +Reviewed-by: Dan Carpenter +Link: https://lore.kernel.org/r/20240827125604.42771-2-riyandhiman14@gmail.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/staging/vme_user/vme_fake.c | 6 ++++++ + drivers/staging/vme_user/vme_tsi148.c | 6 ++++++ + 2 files changed, 12 insertions(+) + +diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c +index 1ee432c223e2b..0c4d60aa00ab2 100644 +--- a/drivers/staging/vme_user/vme_fake.c ++++ b/drivers/staging/vme_user/vme_fake.c +@@ -1071,6 +1071,12 @@ static int __init fake_init(void) + struct vme_slave_resource *slave_image; + struct vme_lm_resource *lm; + ++ if (geoid < 0 || geoid >= VME_MAX_SLOTS) { ++ pr_err("VME geographical address must be between 0 and %d (exclusive), but got %d\n", ++ VME_MAX_SLOTS, geoid); ++ return -EINVAL; ++ } ++ + /* We need a fake parent device */ + vme_root = __root_device_register("vme", THIS_MODULE); + if (IS_ERR(vme_root)) +diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c +index 0171f46d1848f..0e649c8b259d1 100644 +--- a/drivers/staging/vme_user/vme_tsi148.c ++++ b/drivers/staging/vme_user/vme_tsi148.c +@@ -2261,6 +2261,12 @@ static int tsi148_probe(struct pci_dev *pdev, const struct pci_device_id *id) + struct vme_dma_resource *dma_ctrlr; + struct vme_lm_resource *lm; + ++ if (geoid < 0 || geoid >= VME_MAX_SLOTS) { ++ dev_err(&pdev->dev, "VME geographical address must be between 0 and %d (exclusive), but got %d\n", ++ VME_MAX_SLOTS, geoid); ++ return -EINVAL; ++ } ++ + /* If we want to support more than one of each bridge, we need to + * dynamically generate this so we get one per device + */ +-- +2.43.0 + diff --git a/queue-6.1/tools-iio-add-memory-allocation-failure-check-for-tr.patch b/queue-6.1/tools-iio-add-memory-allocation-failure-check-for-tr.patch new file mode 100644 index 00000000000..4dc71ec78be --- /dev/null +++ b/queue-6.1/tools-iio-add-memory-allocation-failure-check-for-tr.patch @@ -0,0 +1,38 @@ +From 0f4e122874eccf2c9849e6e4973bca8e59f36068 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Aug 2024 02:31:29 -0700 +Subject: tools/iio: Add memory allocation failure check for trigger_name + +From: Zhu Jun + +[ Upstream commit 3c6b818b097dd6932859bcc3d6722a74ec5931c1 ] + +Added a check to handle memory allocation failure for `trigger_name` +and return `-ENOMEM`. + +Signed-off-by: Zhu Jun +Link: https://patch.msgid.link/20240828093129.3040-1-zhujun2@cmss.chinamobile.com +Signed-off-by: Jonathan Cameron +Signed-off-by: Sasha Levin +--- + tools/iio/iio_generic_buffer.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/tools/iio/iio_generic_buffer.c b/tools/iio/iio_generic_buffer.c +index 0d0a7a19d6f95..9ef5ee087eda3 100644 +--- a/tools/iio/iio_generic_buffer.c ++++ b/tools/iio/iio_generic_buffer.c +@@ -498,6 +498,10 @@ int main(int argc, char **argv) + return -ENOMEM; + } + trigger_name = malloc(IIO_MAX_NAME_LENGTH); ++ if (!trigger_name) { ++ ret = -ENOMEM; ++ goto error; ++ } + ret = read_sysfs_string("name", trig_dev_name, trigger_name); + free(trig_dev_name); + if (ret < 0) { +-- +2.43.0 + diff --git a/queue-6.1/usb-chipidea-udc-enable-suspend-interrupt-after-usb-.patch b/queue-6.1/usb-chipidea-udc-enable-suspend-interrupt-after-usb-.patch new file mode 100644 index 00000000000..20fa56eef12 --- /dev/null +++ b/queue-6.1/usb-chipidea-udc-enable-suspend-interrupt-after-usb-.patch @@ -0,0 +1,59 @@ +From 7284919bfb003b239e616c43116163f135db181c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 23 Aug 2024 15:38:32 +0800 +Subject: usb: chipidea: udc: enable suspend interrupt after usb reset + +From: Xu Yang + +[ Upstream commit e4fdcc10092fb244218013bfe8ff01c55d54e8e4 ] + +Currently, suspend interrupt is enabled before pullup enable operation. +This will cause a suspend interrupt assert right after pullup DP. This +suspend interrupt is meaningless, so this will ignore such interrupt +by enable it after usb reset completed. + +Signed-off-by: Xu Yang +Acked-by: Peter Chen +Link: https://lore.kernel.org/r/20240823073832.1702135-1-xu.yang_2@nxp.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/chipidea/udc.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c +index 8c3e3a635ac2d..35dfc05854fb7 100644 +--- a/drivers/usb/chipidea/udc.c ++++ b/drivers/usb/chipidea/udc.c +@@ -86,7 +86,7 @@ static int hw_device_state(struct ci_hdrc *ci, u32 dma) + hw_write(ci, OP_ENDPTLISTADDR, ~0, dma); + /* interrupt, error, port change, reset, sleep/suspend */ + hw_write(ci, OP_USBINTR, ~0, +- USBi_UI|USBi_UEI|USBi_PCI|USBi_URI|USBi_SLI); ++ USBi_UI|USBi_UEI|USBi_PCI|USBi_URI); + } else { + hw_write(ci, OP_USBINTR, ~0, 0); + } +@@ -876,6 +876,7 @@ __releases(ci->lock) + __acquires(ci->lock) + { + int retval; ++ u32 intr; + + spin_unlock(&ci->lock); + if (ci->gadget.speed != USB_SPEED_UNKNOWN) +@@ -889,6 +890,11 @@ __acquires(ci->lock) + if (retval) + goto done; + ++ /* clear SLI */ ++ hw_write(ci, OP_USBSTS, USBi_SLI, USBi_SLI); ++ intr = hw_read(ci, OP_USBINTR, ~0); ++ hw_write(ci, OP_USBINTR, ~0, intr | USBi_SLI); ++ + ci->status = usb_ep_alloc_request(&ci->ep0in->ep, GFP_ATOMIC); + if (ci->status == NULL) + retval = -ENOMEM; +-- +2.43.0 + diff --git a/queue-6.1/usb-dwc2-adjust-the-timing-of-usb-driver-interrupt-r.patch b/queue-6.1/usb-dwc2-adjust-the-timing-of-usb-driver-interrupt-r.patch new file mode 100644 index 00000000000..9f1277dae95 --- /dev/null +++ b/queue-6.1/usb-dwc2-adjust-the-timing-of-usb-driver-interrupt-r.patch @@ -0,0 +1,125 @@ +From a0200f4a19648505c19329e237a992a2ca12c338 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 30 Aug 2024 11:17:09 +0800 +Subject: usb: dwc2: Adjust the timing of USB Driver Interrupt Registration in + the Crashkernel Scenario + +From: Shawn Shao + +[ Upstream commit 4058c39bd176daf11a826802d940d86292a6b02b ] + +The issue is that before entering the crash kernel, the DWC USB controller +did not perform operations such as resetting the interrupt mask bits. +After entering the crash kernel,before the USB interrupt handler +registration was completed while loading the DWC USB driver,an GINTSTS_SOF +interrupt was received.This triggered the misroute_irq process within the +GIC handling framework,ultimately leading to the misrouting of the +interrupt,causing it to be handled by the wrong interrupt handler +and resulting in the issue. + +Summary:In a scenario where the kernel triggers a panic and enters +the crash kernel,it is necessary to ensure that the interrupt mask +bit is not enabled before the interrupt registration is complete. +If an interrupt reaches the CPU at this moment,it will certainly +not be handled correctly,especially in cases where this interrupt +is reported frequently. + +Please refer to the Crashkernel dmesg information as follows +(the message on line 3 was added before devm_request_irq is +called by the dwc2_driver_probe function): +[ 5.866837][ T1] dwc2 JMIC0010:01: supply vusb_d not found, using dummy regulator +[ 5.874588][ T1] dwc2 JMIC0010:01: supply vusb_a not found, using dummy regulator +[ 5.882335][ T1] dwc2 JMIC0010:01: before devm_request_irq irq: [71], gintmsk[0xf300080e], gintsts[0x04200009] +[ 5.892686][ C0] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.10.0-jmnd1.2_RC #18 +[ 5.900327][ C0] Hardware name: CMSS HyperCard4-25G/HyperCard4-25G, BIOS 1.6.4 Jul 8 2024 +[ 5.908836][ C0] Call trace: +[ 5.911965][ C0] dump_backtrace+0x0/0x1f0 +[ 5.916308][ C0] show_stack+0x20/0x30 +[ 5.920304][ C0] dump_stack+0xd8/0x140 +[ 5.924387][ C0] pcie_xxx_handler+0x3c/0x1d8 +[ 5.930121][ C0] __handle_irq_event_percpu+0x64/0x1e0 +[ 5.935506][ C0] handle_irq_event+0x80/0x1d0 +[ 5.940109][ C0] try_one_irq+0x138/0x174 +[ 5.944365][ C0] misrouted_irq+0x134/0x140 +[ 5.948795][ C0] note_interrupt+0x1d0/0x30c +[ 5.953311][ C0] handle_irq_event+0x13c/0x1d0 +[ 5.958001][ C0] handle_fasteoi_irq+0xd4/0x260 +[ 5.962779][ C0] __handle_domain_irq+0x88/0xf0 +[ 5.967555][ C0] gic_handle_irq+0x9c/0x2f0 +[ 5.971985][ C0] el1_irq+0xb8/0x140 +[ 5.975807][ C0] __setup_irq+0x3dc/0x7cc +[ 5.980064][ C0] request_threaded_irq+0xf4/0x1b4 +[ 5.985015][ C0] devm_request_threaded_irq+0x80/0x100 +[ 5.990400][ C0] dwc2_driver_probe+0x1b8/0x6b0 +[ 5.995178][ C0] platform_drv_probe+0x5c/0xb0 +[ 5.999868][ C0] really_probe+0xf8/0x51c +[ 6.004125][ C0] driver_probe_device+0xfc/0x170 +[ 6.008989][ C0] device_driver_attach+0xc8/0xd0 +[ 6.013853][ C0] __driver_attach+0xe8/0x1b0 +[ 6.018369][ C0] bus_for_each_dev+0x7c/0xdc +[ 6.022886][ C0] driver_attach+0x2c/0x3c +[ 6.027143][ C0] bus_add_driver+0xdc/0x240 +[ 6.031573][ C0] driver_register+0x80/0x13c +[ 6.036090][ C0] __platform_driver_register+0x50/0x5c +[ 6.041476][ C0] dwc2_platform_driver_init+0x24/0x30 +[ 6.046774][ C0] do_one_initcall+0x50/0x25c +[ 6.051291][ C0] do_initcall_level+0xe4/0xfc +[ 6.055894][ C0] do_initcalls+0x80/0xa4 +[ 6.060064][ C0] kernel_init_freeable+0x198/0x240 +[ 6.065102][ C0] kernel_init+0x1c/0x12c + +Signed-off-by: Shawn Shao +Link: https://lore.kernel.org/r/20240830031709.134-1-shawn.shao@jaguarmicro.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/usb/dwc2/platform.c | 26 ++++++++++++++------------ + 1 file changed, 14 insertions(+), 12 deletions(-) + +diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c +index 2e4c6884f36a4..9de5a1be4a0ae 100644 +--- a/drivers/usb/dwc2/platform.c ++++ b/drivers/usb/dwc2/platform.c +@@ -438,18 +438,6 @@ static int dwc2_driver_probe(struct platform_device *dev) + + spin_lock_init(&hsotg->lock); + +- hsotg->irq = platform_get_irq(dev, 0); +- if (hsotg->irq < 0) +- return hsotg->irq; +- +- dev_dbg(hsotg->dev, "registering common handler for irq%d\n", +- hsotg->irq); +- retval = devm_request_irq(hsotg->dev, hsotg->irq, +- dwc2_handle_common_intr, IRQF_SHARED, +- dev_name(hsotg->dev), hsotg); +- if (retval) +- return retval; +- + hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus"); + if (IS_ERR(hsotg->vbus_supply)) { + retval = PTR_ERR(hsotg->vbus_supply); +@@ -493,6 +481,20 @@ static int dwc2_driver_probe(struct platform_device *dev) + if (retval) + goto error; + ++ hsotg->irq = platform_get_irq(dev, 0); ++ if (hsotg->irq < 0) { ++ retval = hsotg->irq; ++ goto error; ++ } ++ ++ dev_dbg(hsotg->dev, "registering common handler for irq%d\n", ++ hsotg->irq); ++ retval = devm_request_irq(hsotg->dev, hsotg->irq, ++ dwc2_handle_common_intr, IRQF_SHARED, ++ dev_name(hsotg->dev), hsotg); ++ if (retval) ++ goto error; ++ + /* + * For OTG cores, set the force mode bits to reflect the value + * of dr_mode. Force mode bits should not be touched at any +-- +2.43.0 + diff --git a/queue-6.1/virtio_pmem-check-device-status-before-requesting-fl.patch b/queue-6.1/virtio_pmem-check-device-status-before-requesting-fl.patch new file mode 100644 index 00000000000..81dcb28a561 --- /dev/null +++ b/queue-6.1/virtio_pmem-check-device-status-before-requesting-fl.patch @@ -0,0 +1,47 @@ +From 35f1820b9a17327f7ee5488dcdfb6d3f4d5995c2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 26 Aug 2024 21:53:13 +0000 +Subject: virtio_pmem: Check device status before requesting flush + +From: Philip Chen + +[ Upstream commit e25fbcd97cf52c3c9824d44b5c56c19673c3dd50 ] + +If a pmem device is in a bad status, the driver side could wait for +host ack forever in virtio_pmem_flush(), causing the system to hang. + +So add a status check in the beginning of virtio_pmem_flush() to return +early if the device is not activated. + +Signed-off-by: Philip Chen +Message-Id: <20240826215313.2673566-1-philipchen@chromium.org> +Signed-off-by: Michael S. Tsirkin +Acked-by: Pankaj Gupta +--- + drivers/nvdimm/nd_virtio.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/nvdimm/nd_virtio.c b/drivers/nvdimm/nd_virtio.c +index c6a648fd8744a..a78e17a43a9d2 100644 +--- a/drivers/nvdimm/nd_virtio.c ++++ b/drivers/nvdimm/nd_virtio.c +@@ -44,6 +44,15 @@ static int virtio_pmem_flush(struct nd_region *nd_region) + unsigned long flags; + int err, err1; + ++ /* ++ * Don't bother to submit the request to the device if the device is ++ * not activated. ++ */ ++ if (vdev->config->get_status(vdev) & VIRTIO_CONFIG_S_NEEDS_RESET) { ++ dev_info(&vdev->dev, "virtio pmem device needs a reset\n"); ++ return -EIO; ++ } ++ + might_sleep(); + req_data = kmalloc(sizeof(*req_data), GFP_KERNEL); + if (!req_data) +-- +2.43.0 +