From: Greg Kroah-Hartman Date: Sun, 15 Dec 2024 08:26:31 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v5.4.288~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0d2e5f8763b78d4ef0ed993d57f090ee5c1ea360;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: alsa-usb-audio-add-implicit-feedback-quirk-for-yamaha-thr5.patch ata-sata_highbank-fix-of-node-reference-leak-in-highbank_initialize_phys.patch riscv-fix-ipis-usage-in-kfence_protect_page.patch series tcp-check-space-before-adding-mptcp-syn-options.patch usb-dwc2-fix-hcd-port-connection-race.patch usb-dwc2-fix-hcd-resume.patch usb-dwc2-hcd-fix-getportstatus-setportfeature.patch usb-host-max3421-hcd-correctly-abort-a-usb-request.patch --- diff --git a/queue-5.15/alsa-usb-audio-add-implicit-feedback-quirk-for-yamaha-thr5.patch b/queue-5.15/alsa-usb-audio-add-implicit-feedback-quirk-for-yamaha-thr5.patch new file mode 100644 index 00000000000..cc7a9d3a4ad --- /dev/null +++ b/queue-5.15/alsa-usb-audio-add-implicit-feedback-quirk-for-yamaha-thr5.patch @@ -0,0 +1,33 @@ +From 82fdcf9b518b205da040046fbe7747fb3fd18657 Mon Sep 17 00:00:00 2001 +From: Jaakko Salo +Date: Fri, 6 Dec 2024 18:44:48 +0200 +Subject: ALSA: usb-audio: Add implicit feedback quirk for Yamaha THR5 + +From: Jaakko Salo + +commit 82fdcf9b518b205da040046fbe7747fb3fd18657 upstream. + +Use implicit feedback from the capture endpoint to fix popping +sounds during playback. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=219567 +Signed-off-by: Jaakko Salo +Cc: +Link: https://patch.msgid.link/20241206164448.8136-1-jaakkos@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/quirks.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/sound/usb/quirks.c ++++ b/sound/usb/quirks.c +@@ -1768,6 +1768,8 @@ static const struct usb_audio_quirk_flag + QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR), + DEVICE_FLG(0x046d, 0x09a4, /* Logitech QuickCam E 3500 */ + QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR), ++ DEVICE_FLG(0x0499, 0x1506, /* Yamaha THR5 */ ++ QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x0499, 0x1509, /* Steinberg UR22 */ + QUIRK_FLAG_GENERIC_IMPLICIT_FB), + DEVICE_FLG(0x0499, 0x3108, /* Yamaha YIT-W12TX */ diff --git a/queue-5.15/ata-sata_highbank-fix-of-node-reference-leak-in-highbank_initialize_phys.patch b/queue-5.15/ata-sata_highbank-fix-of-node-reference-leak-in-highbank_initialize_phys.patch new file mode 100644 index 00000000000..fc727385f01 --- /dev/null +++ b/queue-5.15/ata-sata_highbank-fix-of-node-reference-leak-in-highbank_initialize_phys.patch @@ -0,0 +1,30 @@ +From 676fe1f6f74db988191dab5df3bf256908177072 Mon Sep 17 00:00:00 2001 +From: Joe Hattori +Date: Thu, 5 Dec 2024 19:30:14 +0900 +Subject: ata: sata_highbank: fix OF node reference leak in highbank_initialize_phys() + +From: Joe Hattori + +commit 676fe1f6f74db988191dab5df3bf256908177072 upstream. + +The OF node reference obtained by of_parse_phandle_with_args() is not +released on early return. Add a of_node_put() call before returning. + +Fixes: 8996b89d6bc9 ("ata: add platform driver for Calxeda AHCI controller") +Signed-off-by: Joe Hattori +Signed-off-by: Damien Le Moal +Signed-off-by: Greg Kroah-Hartman +--- + drivers/ata/sata_highbank.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/ata/sata_highbank.c ++++ b/drivers/ata/sata_highbank.c +@@ -348,6 +348,7 @@ static int highbank_initialize_phys(stru + phy_nodes[phy] = phy_data.np; + cphy_base[phy] = of_iomap(phy_nodes[phy], 0); + if (cphy_base[phy] == NULL) { ++ of_node_put(phy_data.np); + return 0; + } + phy_count += 1; diff --git a/queue-5.15/riscv-fix-ipis-usage-in-kfence_protect_page.patch b/queue-5.15/riscv-fix-ipis-usage-in-kfence_protect_page.patch new file mode 100644 index 00000000000..e842f7ce07a --- /dev/null +++ b/queue-5.15/riscv-fix-ipis-usage-in-kfence_protect_page.patch @@ -0,0 +1,81 @@ +From b3431a8bb336cece8adc452437befa7d4534b2fd Mon Sep 17 00:00:00 2001 +From: Alexandre Ghiti +Date: Mon, 9 Dec 2024 08:41:25 +0100 +Subject: riscv: Fix IPIs usage in kfence_protect_page() + +From: Alexandre Ghiti + +commit b3431a8bb336cece8adc452437befa7d4534b2fd upstream. + +flush_tlb_kernel_range() may use IPIs to flush the TLBs of all the +cores, which triggers the following warning when the irqs are disabled: + +[ 3.455330] WARNING: CPU: 1 PID: 0 at kernel/smp.c:815 smp_call_function_many_cond+0x452/0x520 +[ 3.456647] Modules linked in: +[ 3.457218] CPU: 1 UID: 0 PID: 0 Comm: swapper/1 Not tainted 6.12.0-rc7-00010-g91d3de7240b8 #1 +[ 3.457416] Hardware name: QEMU QEMU Virtual Machine, BIOS +[ 3.457633] epc : smp_call_function_many_cond+0x452/0x520 +[ 3.457736] ra : on_each_cpu_cond_mask+0x1e/0x30 +[ 3.457786] epc : ffffffff800b669a ra : ffffffff800b67c2 sp : ff2000000000bb50 +[ 3.457824] gp : ffffffff815212b8 tp : ff6000008014f080 t0 : 000000000000003f +[ 3.457859] t1 : ffffffff815221e0 t2 : 000000000000000f s0 : ff2000000000bc10 +[ 3.457920] s1 : 0000000000000040 a0 : ffffffff815221e0 a1 : 0000000000000001 +[ 3.457953] a2 : 0000000000010000 a3 : 0000000000000003 a4 : 0000000000000000 +[ 3.458006] a5 : 0000000000000000 a6 : ffffffffffffffff a7 : 0000000000000000 +[ 3.458042] s2 : ffffffff815223be s3 : 00fffffffffff000 s4 : ff600001ffe38fc0 +[ 3.458076] s5 : ff600001ff950d00 s6 : 0000000200000120 s7 : 0000000000000001 +[ 3.458109] s8 : 0000000000000001 s9 : ff60000080841ef0 s10: 0000000000000001 +[ 3.458141] s11: ffffffff81524812 t3 : 0000000000000001 t4 : ff60000080092bc0 +[ 3.458172] t5 : 0000000000000000 t6 : ff200000000236d0 +[ 3.458203] status: 0000000200000100 badaddr: ffffffff800b669a cause: 0000000000000003 +[ 3.458373] [] smp_call_function_many_cond+0x452/0x520 +[ 3.458593] [] on_each_cpu_cond_mask+0x1e/0x30 +[ 3.458625] [] __flush_tlb_range+0x118/0x1ca +[ 3.458656] [] flush_tlb_kernel_range+0x1e/0x26 +[ 3.458683] [] kfence_protect+0xc0/0xce +[ 3.458717] [] kfence_guarded_free+0xc6/0x1c0 +[ 3.458742] [] __kfence_free+0x62/0xc6 +[ 3.458764] [] kfree+0x106/0x32c +[ 3.458786] [] detach_buf_split+0x188/0x1a8 +[ 3.458816] [] virtqueue_get_buf_ctx+0xb6/0x1f6 +[ 3.458839] [] virtqueue_get_buf+0xe/0x16 +[ 3.458880] [] virtblk_done+0x5c/0xe2 +[ 3.458908] [] vring_interrupt+0x6a/0x74 +[ 3.458930] [] __handle_irq_event_percpu+0x7c/0xe2 +[ 3.458956] [] handle_irq_event+0x3c/0x86 +[ 3.458978] [] handle_simple_irq+0x9e/0xbe +[ 3.459004] [] generic_handle_domain_irq+0x1c/0x2a +[ 3.459027] [] imsic_handle_irq+0xba/0x120 +[ 3.459056] [] generic_handle_domain_irq+0x1c/0x2a +[ 3.459080] [] riscv_intc_aia_irq+0x24/0x34 +[ 3.459103] [] handle_riscv_irq+0x2e/0x4c +[ 3.459133] [] call_on_irq_stack+0x32/0x40 + +So only flush the local TLB and let the lazy kfence page fault handling +deal with the faults which could happen when a core has an old protected +pte version cached in its TLB. That leads to potential inaccuracies which +can be tolerated when using kfence. + +Fixes: 47513f243b45 ("riscv: Enable KFENCE for riscv64") +Signed-off-by: Alexandre Ghiti +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20241209074125.52322-1-alexghiti@rivosinc.com +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/include/asm/kfence.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/arch/riscv/include/asm/kfence.h ++++ b/arch/riscv/include/asm/kfence.h +@@ -55,7 +55,9 @@ static inline bool kfence_protect_page(u + else + set_pte(pte, __pte(pte_val(*pte) | _PAGE_PRESENT)); + +- flush_tlb_kernel_range(addr, addr + PAGE_SIZE); ++ preempt_disable(); ++ local_flush_tlb_kernel_range(addr, addr + PAGE_SIZE); ++ preempt_enable(); + + return true; + } diff --git a/queue-5.15/series b/queue-5.15/series new file mode 100644 index 00000000000..c4dcedf6dd3 --- /dev/null +++ b/queue-5.15/series @@ -0,0 +1,8 @@ +tcp-check-space-before-adding-mptcp-syn-options.patch +alsa-usb-audio-add-implicit-feedback-quirk-for-yamaha-thr5.patch +riscv-fix-ipis-usage-in-kfence_protect_page.patch +usb-host-max3421-hcd-correctly-abort-a-usb-request.patch +ata-sata_highbank-fix-of-node-reference-leak-in-highbank_initialize_phys.patch +usb-dwc2-fix-hcd-resume.patch +usb-dwc2-hcd-fix-getportstatus-setportfeature.patch +usb-dwc2-fix-hcd-port-connection-race.patch diff --git a/queue-5.15/tcp-check-space-before-adding-mptcp-syn-options.patch b/queue-5.15/tcp-check-space-before-adding-mptcp-syn-options.patch new file mode 100644 index 00000000000..fc7bcca586c --- /dev/null +++ b/queue-5.15/tcp-check-space-before-adding-mptcp-syn-options.patch @@ -0,0 +1,44 @@ +From 06d64ab46f19ac12f59a1d2aa8cd196b2e4edb5b Mon Sep 17 00:00:00 2001 +From: MoYuanhao +Date: Mon, 9 Dec 2024 13:28:14 +0100 +Subject: tcp: check space before adding MPTCP SYN options + +From: MoYuanhao + +commit 06d64ab46f19ac12f59a1d2aa8cd196b2e4edb5b upstream. + +Ensure there is enough space before adding MPTCP options in +tcp_syn_options(). + +Without this check, 'remaining' could underflow, and causes issues. If +there is not enough space, MPTCP should not be used. + +Signed-off-by: MoYuanhao +Fixes: cec37a6e41aa ("mptcp: Handle MP_CAPABLE options for outgoing connections") +Cc: stable@vger.kernel.org +Acked-by: Matthieu Baerts (NGI0) +[ Matt: Add Fixes, cc Stable, update Description ] +Signed-off-by: Matthieu Baerts (NGI0) +Reviewed-by: Eric Dumazet +Link: https://patch.msgid.link/20241209-net-mptcp-check-space-syn-v1-1-2da992bb6f74@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + net/ipv4/tcp_output.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -824,8 +824,10 @@ static unsigned int tcp_syn_options(stru + unsigned int size; + + if (mptcp_syn_options(sk, skb, &size, &opts->mptcp)) { +- opts->options |= OPTION_MPTCP; +- remaining -= size; ++ if (remaining >= size) { ++ opts->options |= OPTION_MPTCP; ++ remaining -= size; ++ } + } + } + diff --git a/queue-5.15/usb-dwc2-fix-hcd-port-connection-race.patch b/queue-5.15/usb-dwc2-fix-hcd-port-connection-race.patch new file mode 100644 index 00000000000..89b6c246faf --- /dev/null +++ b/queue-5.15/usb-dwc2-fix-hcd-port-connection-race.patch @@ -0,0 +1,68 @@ +From 1cf1bd88f129f3bd647fead4dca270a5894274bb Mon Sep 17 00:00:00 2001 +From: Stefan Wahren +Date: Mon, 2 Dec 2024 01:16:31 +0100 +Subject: usb: dwc2: Fix HCD port connection race + +From: Stefan Wahren + +commit 1cf1bd88f129f3bd647fead4dca270a5894274bb upstream. + +On Raspberry Pis without onboard USB hub frequent device reconnects +can trigger a interrupt storm after DWC2 entered host clock gating. +This is caused by a race between _dwc2_hcd_suspend() and the port +interrupt, which sets port_connect_status. The issue occurs if +port_connect_status is still 1, but there is no connection anymore: + +usb 1-1: USB disconnect, device number 25 +dwc2 3f980000.usb: _dwc2_hcd_suspend: port_connect_status: 1 +dwc2 3f980000.usb: Entering host clock gating. +Disabling IRQ #66 +irq 66: nobody cared (try booting with the "irqpoll" option) +CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.12.0-gc1bb81b13202-dirty #322 +Hardware name: BCM2835 +Call trace: + unwind_backtrace from show_stack+0x10/0x14 + show_stack from dump_stack_lvl+0x50/0x64 + dump_stack_lvl from __report_bad_irq+0x38/0xc0 + __report_bad_irq from note_interrupt+0x2ac/0x2f4 + note_interrupt from handle_irq_event+0x88/0x8c + handle_irq_event from handle_level_irq+0xb4/0x1ac + handle_level_irq from generic_handle_domain_irq+0x24/0x34 + generic_handle_domain_irq from bcm2836_chained_handle_irq+0x24/0x28 + bcm2836_chained_handle_irq from generic_handle_domain_irq+0x24/0x34 + generic_handle_domain_irq from generic_handle_arch_irq+0x34/0x44 + generic_handle_arch_irq from __irq_svc+0x88/0xb0 + Exception stack(0xc1d01f20 to 0xc1d01f68) + 1f20: 0004ef3c 00000001 00000000 00000000 c1d09780 c1f6bb5c c1d04e54 c1c60ca8 + 1f40: c1d04e94 00000000 00000000 c1d092a8 c1f6af20 c1d01f70 c1211b98 c1212f40 + 1f60: 60000013 ffffffff + __irq_svc from default_idle_call+0x1c/0xb0 + default_idle_call from do_idle+0x21c/0x284 + do_idle from cpu_startup_entry+0x28/0x2c + cpu_startup_entry from kernel_init+0x0/0x12c +handlers: + [] dwc2_handle_common_intr + [<58bf98a3>] usb_hcd_irq +Disabling IRQ #66 + +So avoid this by reading the connection status directly. + +Fixes: 113f86d0c302 ("usb: dwc2: Update partial power down entering by system suspend") +Signed-off-by: Stefan Wahren +Link: https://lore.kernel.org/r/20241202001631.75473-4-wahrenst@gmx.net +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/hcd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -4378,7 +4378,7 @@ static int _dwc2_hcd_suspend(struct usb_ + if (hsotg->bus_suspended) + goto skip_power_saving; + +- if (hsotg->flags.b.port_connect_status == 0) ++ if (!(dwc2_read_hprt0(hsotg) & HPRT0_CONNSTS)) + goto skip_power_saving; + + switch (hsotg->params.power_down) { diff --git a/queue-5.15/usb-dwc2-fix-hcd-resume.patch b/queue-5.15/usb-dwc2-fix-hcd-resume.patch new file mode 100644 index 00000000000..42291f7f37c --- /dev/null +++ b/queue-5.15/usb-dwc2-fix-hcd-resume.patch @@ -0,0 +1,66 @@ +From 336f72d3cbf5cc17df2947bbbd2ba6e2509f17e8 Mon Sep 17 00:00:00 2001 +From: Stefan Wahren +Date: Mon, 2 Dec 2024 01:16:29 +0100 +Subject: usb: dwc2: Fix HCD resume + +From: Stefan Wahren + +commit 336f72d3cbf5cc17df2947bbbd2ba6e2509f17e8 upstream. + +The Raspberry Pi can suffer on interrupt storms on HCD resume. The dwc2 +driver sometimes misses to enable HCD_FLAG_HW_ACCESSIBLE before re-enabling +the interrupts. This causes a situation where both handler ignore a incoming +port interrupt and force the upper layers to disable the dwc2 interrupt +line. This leaves the USB interface in a unusable state: + +irq 66: nobody cared (try booting with the "irqpoll" option) +CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W 6.10.0-rc3 +Hardware name: BCM2835 +Call trace: +unwind_backtrace from show_stack+0x10/0x14 +show_stack from dump_stack_lvl+0x50/0x64 +dump_stack_lvl from __report_bad_irq+0x38/0xc0 +__report_bad_irq from note_interrupt+0x2ac/0x2f4 +note_interrupt from handle_irq_event+0x88/0x8c +handle_irq_event from handle_level_irq+0xb4/0x1ac +handle_level_irq from generic_handle_domain_irq+0x24/0x34 +generic_handle_domain_irq from bcm2836_chained_handle_irq+0x24/0x28 +bcm2836_chained_handle_irq from generic_handle_domain_irq+0x24/0x34 +generic_handle_domain_irq from generic_handle_arch_irq+0x34/0x44 +generic_handle_arch_irq from __irq_svc+0x88/0xb0 +Exception stack(0xc1b01f20 to 0xc1b01f68) +1f20: 0005c0d4 00000001 00000000 00000000 c1b09780 c1d6b32c c1b04e54 c1a5eae8 +1f40: c1b04e90 00000000 00000000 00000000 c1d6a8a0 c1b01f70 c11d2da8 c11d4160 +1f60: 60000013 ffffffff +__irq_svc from default_idle_call+0x1c/0xb0 +default_idle_call from do_idle+0x21c/0x284 +do_idle from cpu_startup_entry+0x28/0x2c +cpu_startup_entry from kernel_init+0x0/0x12c +handlers: +[] dwc2_handle_common_intr +[<75cd278b>] usb_hcd_irq +Disabling IRQ #66 + +So enable the HCD_FLAG_HW_ACCESSIBLE flag in case there is a port +connection. + +Fixes: c74c26f6e398 ("usb: dwc2: Fix partial power down exiting by system resume") +Closes: https://lore.kernel.org/linux-usb/3fd0c2fb-4752-45b3-94eb-42352703e1fd@gmx.net/T/ +Link: https://lore.kernel.org/all/5e8cbce0-3260-2971-484f-fc73a3b2bd28@synopsys.com/ +Signed-off-by: Stefan Wahren +Link: https://lore.kernel.org/r/20241202001631.75473-2-wahrenst@gmx.net +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/hcd.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -4464,6 +4464,7 @@ static int _dwc2_hcd_resume(struct usb_h + * Power Down mode. + */ + if (hprt0 & HPRT0_CONNSTS) { ++ set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); + hsotg->lx_state = DWC2_L0; + goto unlock; + } diff --git a/queue-5.15/usb-dwc2-hcd-fix-getportstatus-setportfeature.patch b/queue-5.15/usb-dwc2-hcd-fix-getportstatus-setportfeature.patch new file mode 100644 index 00000000000..de45b0e4a74 --- /dev/null +++ b/queue-5.15/usb-dwc2-hcd-fix-getportstatus-setportfeature.patch @@ -0,0 +1,66 @@ +From a8d3e4a734599c7d0f6735f8db8a812e503395dd Mon Sep 17 00:00:00 2001 +From: Stefan Wahren +Date: Mon, 2 Dec 2024 01:16:30 +0100 +Subject: usb: dwc2: hcd: Fix GetPortStatus & SetPortFeature + +From: Stefan Wahren + +commit a8d3e4a734599c7d0f6735f8db8a812e503395dd upstream. + +On Rasperry Pis without onboard USB hub the power cycle during +power connect init only disable the port but never enabled it again: + + usb usb1-port1: attempt power cycle + +The port relevant part in dwc2_hcd_hub_control() is skipped in case +port_connect_status = 0 under the assumption the core is or will be soon +in device mode. But this assumption is wrong, because after ClearPortFeature +USB_PORT_FEAT_POWER the port_connect_status will also be 0 and +SetPortFeature (incl. USB_PORT_FEAT_POWER) will be a no-op. + +Fix the behavior of dwc2_hcd_hub_control() by replacing the +port_connect_status check with dwc2_is_device_mode(). + +Link: https://github.com/raspberrypi/linux/issues/6247 +Fixes: 7359d482eb4d ("staging: HCD files for the DWC2 driver") +Signed-off-by: Stefan Wahren +Link: https://lore.kernel.org/r/20241202001631.75473-3-wahrenst@gmx.net +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc2/hcd.c | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +--- a/drivers/usb/dwc2/hcd.c ++++ b/drivers/usb/dwc2/hcd.c +@@ -3579,11 +3579,9 @@ static int dwc2_hcd_hub_control(struct d + port_status |= USB_PORT_STAT_C_OVERCURRENT << 16; + } + +- if (!hsotg->flags.b.port_connect_status) { ++ if (dwc2_is_device_mode(hsotg)) { + /* +- * The port is disconnected, which means the core is +- * either in device mode or it soon will be. Just +- * return 0's for the remainder of the port status ++ * Just return 0's for the remainder of the port status + * since the port register can't be read if the core + * is in device mode. + */ +@@ -3653,13 +3651,11 @@ static int dwc2_hcd_hub_control(struct d + if (wvalue != USB_PORT_FEAT_TEST && (!windex || windex > 1)) + goto error; + +- if (!hsotg->flags.b.port_connect_status) { ++ if (dwc2_is_device_mode(hsotg)) { + /* +- * The port is disconnected, which means the core is +- * either in device mode or it soon will be. Just +- * return without doing anything since the port +- * register can't be written if the core is in device +- * mode. ++ * Just return 0's for the remainder of the port status ++ * since the port register can't be read if the core ++ * is in device mode. + */ + break; + } diff --git a/queue-5.15/usb-host-max3421-hcd-correctly-abort-a-usb-request.patch b/queue-5.15/usb-host-max3421-hcd-correctly-abort-a-usb-request.patch new file mode 100644 index 00000000000..95f65be6eb7 --- /dev/null +++ b/queue-5.15/usb-host-max3421-hcd-correctly-abort-a-usb-request.patch @@ -0,0 +1,50 @@ +From 0d2ada05227881f3d0722ca2364e3f7a860a301f Mon Sep 17 00:00:00 2001 +From: Mark Tomlinson +Date: Mon, 25 Nov 2024 11:14:30 +1300 +Subject: usb: host: max3421-hcd: Correctly abort a USB request. + +From: Mark Tomlinson + +commit 0d2ada05227881f3d0722ca2364e3f7a860a301f upstream. + +If the current USB request was aborted, the spi thread would not respond +to any further requests. This is because the "curr_urb" pointer would +not become NULL, so no further requests would be taken off the queue. +The solution here is to set the "urb_done" flag, as this will cause the +correct handling of the URB. Also clear interrupts that should only be +expected if an URB is in progress. + +Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host driver.") +Cc: stable +Signed-off-by: Mark Tomlinson +Link: https://lore.kernel.org/r/20241124221430.1106080-1-mark.tomlinson@alliedtelesis.co.nz +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/max3421-hcd.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +--- a/drivers/usb/host/max3421-hcd.c ++++ b/drivers/usb/host/max3421-hcd.c +@@ -785,11 +785,17 @@ max3421_check_unlink(struct usb_hcd *hcd + retval = 1; + dev_dbg(&spi->dev, "%s: URB %p unlinked=%d", + __func__, urb, urb->unlinked); +- usb_hcd_unlink_urb_from_ep(hcd, urb); +- spin_unlock_irqrestore(&max3421_hcd->lock, +- flags); +- usb_hcd_giveback_urb(hcd, urb, 0); +- spin_lock_irqsave(&max3421_hcd->lock, flags); ++ if (urb == max3421_hcd->curr_urb) { ++ max3421_hcd->urb_done = 1; ++ max3421_hcd->hien &= ~(BIT(MAX3421_HI_HXFRDN_BIT) | ++ BIT(MAX3421_HI_RCVDAV_BIT)); ++ } else { ++ usb_hcd_unlink_urb_from_ep(hcd, urb); ++ spin_unlock_irqrestore(&max3421_hcd->lock, ++ flags); ++ usb_hcd_giveback_urb(hcd, urb, 0); ++ spin_lock_irqsave(&max3421_hcd->lock, flags); ++ } + } + } + }