From: Greg Kroah-Hartman Date: Mon, 28 Apr 2025 17:24:42 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.4.293~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=89e510cb1dbd3c9fb3c21bd5dda0f585cbfea825;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: kvm-x86-reset-irte-to-host-control-if-new-route-isn-t-postable.patch serial-msm-configure-correct-working-mode-before-starting-earlycon.patch serial-sifive-lock-port-in-startup-shutdown-callbacks.patch usb-cdns3-fix-deadlock-when-using-ncm-gadget.patch usb-chipidea-ci_hdrc_imx-fix-call-balance-of-regulator-routines.patch usb-dwc3-gadget-check-that-event-count-does-not-exceed-event-buffer-length.patch usb-ohci-add-quirk-for-ls7a-ohci-controller-rev-0x02.patch usb-quirks-add-delay-init-quirk-for-sandisk-3.2gen1-flash-drive.patch usb-quirks-add-delay_init-quirk-for-silicon-motion-flash-drive.patch usb-serial-ftdi_sio-add-support-for-abacus-electrics-optical-probe.patch usb-serial-option-add-sierra-wireless-em9291.patch usb-serial-simple-add-owon-hds200-series-oscilloscope-support.patch usb-vli-disk-crashes-if-lpm-is-used.patch --- diff --git a/queue-5.10/kvm-x86-reset-irte-to-host-control-if-new-route-isn-t-postable.patch b/queue-5.10/kvm-x86-reset-irte-to-host-control-if-new-route-isn-t-postable.patch new file mode 100644 index 0000000000..fac3301202 --- /dev/null +++ b/queue-5.10/kvm-x86-reset-irte-to-host-control-if-new-route-isn-t-postable.patch @@ -0,0 +1,178 @@ +From 9bcac97dc42d2f4da8229d18feb0fe2b1ce523a2 Mon Sep 17 00:00:00 2001 +From: Sean Christopherson +Date: Fri, 4 Apr 2025 12:38:17 -0700 +Subject: KVM: x86: Reset IRTE to host control if *new* route isn't postable + +From: Sean Christopherson + +commit 9bcac97dc42d2f4da8229d18feb0fe2b1ce523a2 upstream. + +Restore an IRTE back to host control (remapped or posted MSI mode) if the +*new* GSI route prevents posting the IRQ directly to a vCPU, regardless of +the GSI routing type. Updating the IRTE if and only if the new GSI is an +MSI results in KVM leaving an IRTE posting to a vCPU. + +The dangling IRTE can result in interrupts being incorrectly delivered to +the guest, and in the worst case scenario can result in use-after-free, +e.g. if the VM is torn down, but the underlying host IRQ isn't freed. + +Fixes: efc644048ecd ("KVM: x86: Update IRTE for posted-interrupts") +Fixes: 411b44ba80ab ("svm: Implements update_pi_irte hook to setup posted interrupt") +Cc: stable@vger.kernel.org +Signed-off-by: Sean Christopherson +Message-ID: <20250404193923.1413163-3-seanjc@google.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Greg Kroah-Hartman +--- + arch/x86/kvm/svm/avic.c | 58 +++++++++++++++++++++-------------------- + arch/x86/kvm/vmx/posted_intr.c | 28 +++++++------------ + 2 files changed, 41 insertions(+), 45 deletions(-) + +--- a/arch/x86/kvm/svm/avic.c ++++ b/arch/x86/kvm/svm/avic.c +@@ -806,6 +806,7 @@ int svm_update_pi_irte(struct kvm *kvm, + { + struct kvm_kernel_irq_routing_entry *e; + struct kvm_irq_routing_table *irq_rt; ++ bool enable_remapped_mode = true; + int idx, ret = 0; + + if (!kvm_arch_has_assigned_device(kvm) || +@@ -843,6 +844,8 @@ int svm_update_pi_irte(struct kvm *kvm, + kvm_vcpu_apicv_active(&svm->vcpu)) { + struct amd_iommu_pi_data pi; + ++ enable_remapped_mode = false; ++ + /* Try to enable guest_mode in IRTE */ + pi.base = __sme_set(page_to_phys(svm->avic_backing_page) & + AVIC_HPA_MASK); +@@ -861,33 +864,6 @@ int svm_update_pi_irte(struct kvm *kvm, + */ + if (!ret && pi.is_guest_mode) + svm_ir_list_add(svm, &pi); +- } else { +- /* Use legacy mode in IRTE */ +- struct amd_iommu_pi_data pi; +- +- /** +- * Here, pi is used to: +- * - Tell IOMMU to use legacy mode for this interrupt. +- * - Retrieve ga_tag of prior interrupt remapping data. +- */ +- pi.prev_ga_tag = 0; +- pi.is_guest_mode = false; +- ret = irq_set_vcpu_affinity(host_irq, &pi); +- +- /** +- * Check if the posted interrupt was previously +- * setup with the guest_mode by checking if the ga_tag +- * was cached. If so, we need to clean up the per-vcpu +- * ir_list. +- */ +- if (!ret && pi.prev_ga_tag) { +- int id = AVIC_GATAG_TO_VCPUID(pi.prev_ga_tag); +- struct kvm_vcpu *vcpu; +- +- vcpu = kvm_get_vcpu_by_id(kvm, id); +- if (vcpu) +- svm_ir_list_del(to_svm(vcpu), &pi); +- } + } + + if (!ret && svm) { +@@ -903,6 +879,34 @@ int svm_update_pi_irte(struct kvm *kvm, + } + + ret = 0; ++ if (enable_remapped_mode) { ++ /* Use legacy mode in IRTE */ ++ struct amd_iommu_pi_data pi; ++ ++ /** ++ * Here, pi is used to: ++ * - Tell IOMMU to use legacy mode for this interrupt. ++ * - Retrieve ga_tag of prior interrupt remapping data. ++ */ ++ pi.prev_ga_tag = 0; ++ pi.is_guest_mode = false; ++ ret = irq_set_vcpu_affinity(host_irq, &pi); ++ ++ /** ++ * Check if the posted interrupt was previously ++ * setup with the guest_mode by checking if the ga_tag ++ * was cached. If so, we need to clean up the per-vcpu ++ * ir_list. ++ */ ++ if (!ret && pi.prev_ga_tag) { ++ int id = AVIC_GATAG_TO_VCPUID(pi.prev_ga_tag); ++ struct kvm_vcpu *vcpu; ++ ++ vcpu = kvm_get_vcpu_by_id(kvm, id); ++ if (vcpu) ++ svm_ir_list_del(to_svm(vcpu), &pi); ++ } ++ } + out: + srcu_read_unlock(&kvm->irq_srcu, idx); + return ret; +--- a/arch/x86/kvm/vmx/posted_intr.c ++++ b/arch/x86/kvm/vmx/posted_intr.c +@@ -255,6 +255,7 @@ int pi_update_irte(struct kvm *kvm, unsi + { + struct kvm_kernel_irq_routing_entry *e; + struct kvm_irq_routing_table *irq_rt; ++ bool enable_remapped_mode = true; + struct kvm_lapic_irq irq; + struct kvm_vcpu *vcpu; + struct vcpu_data vcpu_info; +@@ -293,21 +294,8 @@ int pi_update_irte(struct kvm *kvm, unsi + + kvm_set_msi_irq(kvm, e, &irq); + if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu) || +- !kvm_irq_is_postable(&irq)) { +- /* +- * Make sure the IRTE is in remapped mode if +- * we don't handle it in posted mode. +- */ +- ret = irq_set_vcpu_affinity(host_irq, NULL); +- if (ret < 0) { +- printk(KERN_INFO +- "failed to back to remapped mode, irq: %u\n", +- host_irq); +- goto out; +- } +- ++ !kvm_irq_is_postable(&irq)) + continue; +- } + + vcpu_info.pi_desc_addr = __pa(&to_vmx(vcpu)->pi_desc); + vcpu_info.vector = irq.vector; +@@ -315,11 +303,12 @@ int pi_update_irte(struct kvm *kvm, unsi + trace_kvm_pi_irte_update(host_irq, vcpu->vcpu_id, e->gsi, + vcpu_info.vector, vcpu_info.pi_desc_addr, set); + +- if (set) +- ret = irq_set_vcpu_affinity(host_irq, &vcpu_info); +- else +- ret = irq_set_vcpu_affinity(host_irq, NULL); ++ if (!set) ++ continue; + ++ enable_remapped_mode = false; ++ ++ ret = irq_set_vcpu_affinity(host_irq, &vcpu_info); + if (ret < 0) { + printk(KERN_INFO "%s: failed to update PI IRTE\n", + __func__); +@@ -327,6 +316,9 @@ int pi_update_irte(struct kvm *kvm, unsi + } + } + ++ if (enable_remapped_mode) ++ ret = irq_set_vcpu_affinity(host_irq, NULL); ++ + ret = 0; + out: + srcu_read_unlock(&kvm->irq_srcu, idx); diff --git a/queue-5.10/serial-msm-configure-correct-working-mode-before-starting-earlycon.patch b/queue-5.10/serial-msm-configure-correct-working-mode-before-starting-earlycon.patch new file mode 100644 index 0000000000..9c3f221be7 --- /dev/null +++ b/queue-5.10/serial-msm-configure-correct-working-mode-before-starting-earlycon.patch @@ -0,0 +1,54 @@ +From 7094832b5ac861b0bd7ed8866c93cb15ef619996 Mon Sep 17 00:00:00 2001 +From: Stephan Gerhold +Date: Tue, 8 Apr 2025 19:22:47 +0200 +Subject: serial: msm: Configure correct working mode before starting earlycon + +From: Stephan Gerhold + +commit 7094832b5ac861b0bd7ed8866c93cb15ef619996 upstream. + +The MSM UART DM controller supports different working modes, e.g. DMA or +the "single-character mode", where all reads/writes operate on a single +character rather than 4 chars (32-bit) at once. When using earlycon, +__msm_console_write() always writes 4 characters at a time, but we don't +know which mode the bootloader was using and we don't set the mode either. + +This causes garbled output if the bootloader was using the single-character +mode, because only every 4th character appears in the serial console, e.g. + + "[ 00oni pi 000xf0[ 00i s 5rm9(l)l s 1 1 SPMTA 7:C 5[ 00A ade k d[ + 00ano:ameoi .Q1B[ 00ac _idaM00080oo'" + +If the bootloader was using the DMA ("DM") mode, output would likely fail +entirely. Later, when the full serial driver probes, the port is +re-initialized and output works as expected. + +Fix this also for earlycon by clearing the DMEN register and +reset+re-enable the transmitter to apply the change. This ensures the +transmitter is in the expected state before writing any output. + +Cc: stable +Fixes: 0efe72963409 ("tty: serial: msm: Add earlycon support") +Signed-off-by: Stephan Gerhold +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20250408-msm-serial-earlycon-v1-1-429080127530@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/msm_serial.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/tty/serial/msm_serial.c ++++ b/drivers/tty/serial/msm_serial.c +@@ -1737,6 +1737,12 @@ msm_serial_early_console_setup_dm(struct + if (!device->port.membase) + return -ENODEV; + ++ /* Disable DM / single-character modes */ ++ msm_write(&device->port, 0, UARTDM_DMEN); ++ msm_write(&device->port, MSM_UART_CR_CMD_RESET_RX, MSM_UART_CR); ++ msm_write(&device->port, MSM_UART_CR_CMD_RESET_TX, MSM_UART_CR); ++ msm_write(&device->port, MSM_UART_CR_TX_ENABLE, MSM_UART_CR); ++ + device->con->write = msm_serial_early_write_dm; + return 0; + } diff --git a/queue-5.10/serial-sifive-lock-port-in-startup-shutdown-callbacks.patch b/queue-5.10/serial-sifive-lock-port-in-startup-shutdown-callbacks.patch new file mode 100644 index 0000000000..e811ca3b55 --- /dev/null +++ b/queue-5.10/serial-sifive-lock-port-in-startup-shutdown-callbacks.patch @@ -0,0 +1,59 @@ +From e1ca3ff28ab1e2c1e70713ef3fa7943c725742c3 Mon Sep 17 00:00:00 2001 +From: Ryo Takakura +Date: Sat, 12 Apr 2025 09:18:47 +0900 +Subject: serial: sifive: lock port in startup()/shutdown() callbacks + +From: Ryo Takakura + +commit e1ca3ff28ab1e2c1e70713ef3fa7943c725742c3 upstream. + +startup()/shutdown() callbacks access SIFIVE_SERIAL_IE_OFFS. +The register is also accessed from write() callback. + +If console were printing and startup()/shutdown() callback +gets called, its access to the register could be overwritten. + +Add port->lock to startup()/shutdown() callbacks to make sure +their access to SIFIVE_SERIAL_IE_OFFS is synchronized against +write() callback. + +Fixes: 45c054d0815b ("tty: serial: add driver for the SiFive UART") +Signed-off-by: Ryo Takakura +Reviewed-by: Petr Mladek +Cc: stable@vger.kernel.org +Reviewed-by: John Ogness +Rule: add +Link: https://lore.kernel.org/stable/20250330003522.386632-1-ryotkkr98%40gmail.com +Link: https://lore.kernel.org/r/20250412001847.183221-1-ryotkkr98@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/sifive.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/tty/serial/sifive.c ++++ b/drivers/tty/serial/sifive.c +@@ -596,8 +596,11 @@ static void sifive_serial_break_ctl(stru + static int sifive_serial_startup(struct uart_port *port) + { + struct sifive_serial_port *ssp = port_to_sifive_serial_port(port); ++ unsigned long flags; + ++ uart_port_lock_irqsave(&ssp->port, &flags); + __ssp_enable_rxwm(ssp); ++ uart_port_unlock_irqrestore(&ssp->port, flags); + + return 0; + } +@@ -605,9 +608,12 @@ static int sifive_serial_startup(struct + static void sifive_serial_shutdown(struct uart_port *port) + { + struct sifive_serial_port *ssp = port_to_sifive_serial_port(port); ++ unsigned long flags; + ++ uart_port_lock_irqsave(&ssp->port, &flags); + __ssp_disable_rxwm(ssp); + __ssp_disable_txwm(ssp); ++ uart_port_unlock_irqrestore(&ssp->port, flags); + } + + /** diff --git a/queue-5.10/series b/queue-5.10/series index fcb79989e6..cf4b71ed74 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -245,3 +245,16 @@ kvm-svm-allocate-ir-data-using-atomic-allocation.patch mcb-fix-a-double-free-bug-in-chameleon_parse_gdd.patch usb-storage-quirk-for-adata-portable-hdd-ch94.patch mei-me-add-panther-lake-h-did.patch +kvm-x86-reset-irte-to-host-control-if-new-route-isn-t-postable.patch +serial-msm-configure-correct-working-mode-before-starting-earlycon.patch +serial-sifive-lock-port-in-startup-shutdown-callbacks.patch +usb-serial-ftdi_sio-add-support-for-abacus-electrics-optical-probe.patch +usb-serial-option-add-sierra-wireless-em9291.patch +usb-serial-simple-add-owon-hds200-series-oscilloscope-support.patch +usb-cdns3-fix-deadlock-when-using-ncm-gadget.patch +usb-chipidea-ci_hdrc_imx-fix-call-balance-of-regulator-routines.patch +usb-ohci-add-quirk-for-ls7a-ohci-controller-rev-0x02.patch +usb-dwc3-gadget-check-that-event-count-does-not-exceed-event-buffer-length.patch +usb-quirks-add-delay_init-quirk-for-silicon-motion-flash-drive.patch +usb-quirks-add-delay-init-quirk-for-sandisk-3.2gen1-flash-drive.patch +usb-vli-disk-crashes-if-lpm-is-used.patch diff --git a/queue-5.10/usb-cdns3-fix-deadlock-when-using-ncm-gadget.patch b/queue-5.10/usb-cdns3-fix-deadlock-when-using-ncm-gadget.patch new file mode 100644 index 0000000000..befb8719b0 --- /dev/null +++ b/queue-5.10/usb-cdns3-fix-deadlock-when-using-ncm-gadget.patch @@ -0,0 +1,48 @@ +From a1059896f2bfdcebcdc7153c3be2307ea319501f Mon Sep 17 00:00:00 2001 +From: Ralph Siemsen +Date: Tue, 18 Mar 2025 11:09:32 -0400 +Subject: usb: cdns3: Fix deadlock when using NCM gadget + +From: Ralph Siemsen + +commit a1059896f2bfdcebcdc7153c3be2307ea319501f upstream. + +The cdns3 driver has the same NCM deadlock as fixed in cdnsp by commit +58f2fcb3a845 ("usb: cdnsp: Fix deadlock issue during using NCM gadget"). + +Under PREEMPT_RT the deadlock can be readily triggered by heavy network +traffic, for example using "iperf --bidir" over NCM ethernet link. + +The deadlock occurs because the threaded interrupt handler gets +preempted by a softirq, but both are protected by the same spinlock. +Prevent deadlock by disabling softirq during threaded irq handler. + +Cc: stable +Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") +Signed-off-by: Ralph Siemsen +Acked-by: Peter Chen +Reviewed-by: Sebastian Andrzej Siewior +Link: https://lore.kernel.org/r/20250318-rfs-cdns3-deadlock-v2-1-bfd9cfcee732@linaro.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/cdns3/gadget.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/cdns3/gadget.c ++++ b/drivers/usb/cdns3/gadget.c +@@ -1961,6 +1961,7 @@ static irqreturn_t cdns3_device_thread_i + unsigned int bit; + unsigned long reg; + ++ local_bh_disable(); + spin_lock_irqsave(&priv_dev->lock, flags); + + reg = readl(&priv_dev->regs->usb_ists); +@@ -2002,6 +2003,7 @@ static irqreturn_t cdns3_device_thread_i + irqend: + writel(~0, &priv_dev->regs->ep_ien); + spin_unlock_irqrestore(&priv_dev->lock, flags); ++ local_bh_enable(); + + return ret; + } diff --git a/queue-5.10/usb-chipidea-ci_hdrc_imx-fix-call-balance-of-regulator-routines.patch b/queue-5.10/usb-chipidea-ci_hdrc_imx-fix-call-balance-of-regulator-routines.patch new file mode 100644 index 0000000000..37c65db78f --- /dev/null +++ b/queue-5.10/usb-chipidea-ci_hdrc_imx-fix-call-balance-of-regulator-routines.patch @@ -0,0 +1,92 @@ +From 8cab0e9a3f3e8d700179e0d6141643d54a267fd5 Mon Sep 17 00:00:00 2001 +From: Fedor Pchelkin +Date: Sun, 16 Mar 2025 13:26:55 +0300 +Subject: usb: chipidea: ci_hdrc_imx: fix call balance of regulator routines + +From: Fedor Pchelkin + +commit 8cab0e9a3f3e8d700179e0d6141643d54a267fd5 upstream. + +Upon encountering errors during the HSIC pinctrl handling section the +regulator should be disabled. + +Use devm_add_action_or_reset() to let the regulator-disabling routine be +handled by device resource management stack. + +Found by Linux Verification Center (linuxtesting.org). + +Fixes: 4d6141288c33 ("usb: chipidea: imx: pinctrl for HSIC is optional") +Cc: stable +Signed-off-by: Fedor Pchelkin +Acked-by: Peter Chen +Link: https://lore.kernel.org/r/20250316102658.490340-3-pchelkin@ispras.ru +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/chipidea/ci_hdrc_imx.c | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +--- a/drivers/usb/chipidea/ci_hdrc_imx.c ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c +@@ -322,6 +322,13 @@ static int ci_hdrc_imx_notify_event(stru + return ret; + } + ++static void ci_hdrc_imx_disable_regulator(void *arg) ++{ ++ struct ci_hdrc_imx_data *data = arg; ++ ++ regulator_disable(data->hsic_pad_regulator); ++} ++ + static int ci_hdrc_imx_probe(struct platform_device *pdev) + { + struct ci_hdrc_imx_data *data; +@@ -387,6 +394,13 @@ static int ci_hdrc_imx_probe(struct plat + "Failed to enable HSIC pad regulator\n"); + return ret; + } ++ ret = devm_add_action_or_reset(dev, ++ ci_hdrc_imx_disable_regulator, data); ++ if (ret) { ++ dev_err(dev, ++ "Failed to add regulator devm action\n"); ++ goto err_put; ++ } + } + } + +@@ -423,11 +437,11 @@ static int ci_hdrc_imx_probe(struct plat + + ret = imx_get_clks(dev); + if (ret) +- goto disable_hsic_regulator; ++ goto qos_remove_request; + + ret = imx_prepare_enable_clks(dev); + if (ret) +- goto disable_hsic_regulator; ++ goto qos_remove_request; + + data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0); + if (IS_ERR(data->phy)) { +@@ -509,10 +523,7 @@ disable_device: + ci_hdrc_remove_device(data->ci_pdev); + err_clk: + imx_disable_unprepare_clks(dev); +-disable_hsic_regulator: +- if (data->hsic_pad_regulator) +- /* don't overwrite original ret (cf. EPROBE_DEFER) */ +- regulator_disable(data->hsic_pad_regulator); ++qos_remove_request: + if (pdata.flags & CI_HDRC_PMQOS) + cpu_latency_qos_remove_request(&data->pm_qos_req); + data->ci_pdev = NULL; +@@ -536,8 +547,6 @@ static int ci_hdrc_imx_remove(struct pla + imx_disable_unprepare_clks(&pdev->dev); + if (data->plat_data->flags & CI_HDRC_PMQOS) + cpu_latency_qos_remove_request(&data->pm_qos_req); +- if (data->hsic_pad_regulator) +- regulator_disable(data->hsic_pad_regulator); + } + + return 0; diff --git a/queue-5.10/usb-dwc3-gadget-check-that-event-count-does-not-exceed-event-buffer-length.patch b/queue-5.10/usb-dwc3-gadget-check-that-event-count-does-not-exceed-event-buffer-length.patch new file mode 100644 index 0000000000..309bdfad34 --- /dev/null +++ b/queue-5.10/usb-dwc3-gadget-check-that-event-count-does-not-exceed-event-buffer-length.patch @@ -0,0 +1,49 @@ +From 63ccd26cd1f6600421795f6ca3e625076be06c9f Mon Sep 17 00:00:00 2001 +From: Frode Isaksen +Date: Thu, 3 Apr 2025 09:28:03 +0200 +Subject: usb: dwc3: gadget: check that event count does not exceed event buffer length + +From: Frode Isaksen + +commit 63ccd26cd1f6600421795f6ca3e625076be06c9f upstream. + +The event count is read from register DWC3_GEVNTCOUNT. +There is a check for the count being zero, but not for exceeding the +event buffer length. +Check that event count does not exceed event buffer length, +avoiding an out-of-bounds access when memcpy'ing the event. +Crash log: +Unable to handle kernel paging request at virtual address ffffffc0129be000 +pc : __memcpy+0x114/0x180 +lr : dwc3_check_event_buf+0xec/0x348 +x3 : 0000000000000030 x2 : 000000000000dfc4 +x1 : ffffffc0129be000 x0 : ffffff87aad60080 +Call trace: +__memcpy+0x114/0x180 +dwc3_interrupt+0x24/0x34 + +Signed-off-by: Frode Isaksen +Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver") +Cc: stable +Acked-by: Thinh Nguyen +Link: https://lore.kernel.org/r/20250403072907.448524-1-fisaksen@baylibre.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/gadget.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -3896,6 +3896,12 @@ static irqreturn_t dwc3_check_event_buf( + if (!count) + return IRQ_NONE; + ++ if (count > evt->length) { ++ dev_err_ratelimited(dwc->dev, "invalid count(%u) > evt->length(%u)\n", ++ count, evt->length); ++ return IRQ_NONE; ++ } ++ + evt->count = count; + evt->flags |= DWC3_EVENT_PENDING; + diff --git a/queue-5.10/usb-ohci-add-quirk-for-ls7a-ohci-controller-rev-0x02.patch b/queue-5.10/usb-ohci-add-quirk-for-ls7a-ohci-controller-rev-0x02.patch new file mode 100644 index 0000000000..2cbc5b3998 --- /dev/null +++ b/queue-5.10/usb-ohci-add-quirk-for-ls7a-ohci-controller-rev-0x02.patch @@ -0,0 +1,67 @@ +From bcb60d438547355b8f9ad48645909139b64d3482 Mon Sep 17 00:00:00 2001 +From: Huacai Chen +Date: Fri, 28 Mar 2025 12:00:59 +0800 +Subject: USB: OHCI: Add quirk for LS7A OHCI controller (rev 0x02) + +From: Huacai Chen + +commit bcb60d438547355b8f9ad48645909139b64d3482 upstream. + +The OHCI controller (rev 0x02) under LS7A PCI host has a hardware flaw. +MMIO register with offset 0x60/0x64 is treated as legacy PS2-compatible +keyboard/mouse interface, which confuse the OHCI controller. Since OHCI +only use a 4KB BAR resource indeed, the LS7A OHCI controller's 32KB BAR +is wrapped around (the second 4KB BAR space is the same as the first 4KB +internally). So we can add an 4KB offset (0x1000) to the OHCI registers +(from the PCI BAR resource) as a quirk. + +Cc: stable +Suggested-by: Bjorn Helgaas +Reviewed-by: Alan Stern +Tested-by: Mingcong Bai +Signed-off-by: Huacai Chen +Link: https://lore.kernel.org/r/20250328040059.3672979-1-chenhuacai@loongson.cn +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/ohci-pci.c | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +--- a/drivers/usb/host/ohci-pci.c ++++ b/drivers/usb/host/ohci-pci.c +@@ -165,6 +165,25 @@ static int ohci_quirk_amd700(struct usb_ + return 0; + } + ++static int ohci_quirk_loongson(struct usb_hcd *hcd) ++{ ++ struct pci_dev *pdev = to_pci_dev(hcd->self.controller); ++ ++ /* ++ * Loongson's LS7A OHCI controller (rev 0x02) has a ++ * flaw. MMIO register with offset 0x60/64 is treated ++ * as legacy PS2-compatible keyboard/mouse interface. ++ * Since OHCI only use 4KB BAR resource, LS7A OHCI's ++ * 32KB BAR is wrapped around (the 2nd 4KB BAR space ++ * is the same as the 1st 4KB internally). So add 4KB ++ * offset (0x1000) to the OHCI registers as a quirk. ++ */ ++ if (pdev->revision == 0x2) ++ hcd->regs += SZ_4K; /* SZ_4K = 0x1000 */ ++ ++ return 0; ++} ++ + static int ohci_quirk_qemu(struct usb_hcd *hcd) + { + struct ohci_hcd *ohci = hcd_to_ohci(hcd); +@@ -225,6 +244,10 @@ static const struct pci_device_id ohci_p + .driver_data = (unsigned long)ohci_quirk_amd700, + }, + { ++ PCI_DEVICE(PCI_VENDOR_ID_LOONGSON, 0x7a24), ++ .driver_data = (unsigned long)ohci_quirk_loongson, ++ }, ++ { + .vendor = PCI_VENDOR_ID_APPLE, + .device = 0x003f, + .subvendor = PCI_SUBVENDOR_ID_REDHAT_QUMRANET, diff --git a/queue-5.10/usb-quirks-add-delay-init-quirk-for-sandisk-3.2gen1-flash-drive.patch b/queue-5.10/usb-quirks-add-delay-init-quirk-for-sandisk-3.2gen1-flash-drive.patch new file mode 100644 index 0000000000..986b15284b --- /dev/null +++ b/queue-5.10/usb-quirks-add-delay-init-quirk-for-sandisk-3.2gen1-flash-drive.patch @@ -0,0 +1,37 @@ +From 37ffdbd695c02189dbf23d6e7d2385e0299587ca Mon Sep 17 00:00:00 2001 +From: Miao Li +Date: Mon, 14 Apr 2025 14:29:35 +0800 +Subject: usb: quirks: Add delay init quirk for SanDisk 3.2Gen1 Flash Drive + +From: Miao Li + +commit 37ffdbd695c02189dbf23d6e7d2385e0299587ca upstream. + +The SanDisk 3.2Gen1 Flash Drive, which VID:PID is in 0781:55a3, +just like Silicon Motion Flash Drive: +https://lore.kernel.org/r/20250401023027.44894-1-limiao870622@163.com +also needs the DELAY_INIT quirk, or it will randomly work incorrectly +(e.g.: lsusb and can't list this device info) when connecting Huawei +hisi platforms and doing thousand of reboot test circles. + +Cc: stable +Signed-off-by: Miao Li +Signed-off-by: Lei Huang +Link: https://lore.kernel.org/r/20250414062935.159024-1-limiao870622@163.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/quirks.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -366,6 +366,9 @@ static const struct usb_device_id usb_qu + { USB_DEVICE(0x0781, 0x5583), .driver_info = USB_QUIRK_NO_LPM }, + { USB_DEVICE(0x0781, 0x5591), .driver_info = USB_QUIRK_NO_LPM }, + ++ /* SanDisk Corp. SanDisk 3.2Gen1 */ ++ { USB_DEVICE(0x0781, 0x55a3), .driver_info = USB_QUIRK_DELAY_INIT }, ++ + /* Realforce 87U Keyboard */ + { USB_DEVICE(0x0853, 0x011b), .driver_info = USB_QUIRK_NO_LPM }, + diff --git a/queue-5.10/usb-quirks-add-delay_init-quirk-for-silicon-motion-flash-drive.patch b/queue-5.10/usb-quirks-add-delay_init-quirk-for-silicon-motion-flash-drive.patch new file mode 100644 index 0000000000..ad1ef2ab56 --- /dev/null +++ b/queue-5.10/usb-quirks-add-delay_init-quirk-for-silicon-motion-flash-drive.patch @@ -0,0 +1,34 @@ +From 2932b6b547ec36ad2ed60fbf2117c0e46bb7d40a Mon Sep 17 00:00:00 2001 +From: Miao Li +Date: Tue, 1 Apr 2025 10:30:27 +0800 +Subject: usb: quirks: add DELAY_INIT quirk for Silicon Motion Flash Drive + +From: Miao Li + +commit 2932b6b547ec36ad2ed60fbf2117c0e46bb7d40a upstream. + +Silicon Motion Flash Drive connects to Huawei hisi platforms and +performs a system reboot test for two thousand circles, it will +randomly work incorrectly on boot, set DELAY_INIT quirk can workaround +this issue. + +Signed-off-by: Miao Li +Cc: stable +Link: https://lore.kernel.org/r/20250401023027.44894-1-limiao870622@163.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/quirks.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -380,6 +380,9 @@ static const struct usb_device_id usb_qu + { USB_DEVICE(0x0904, 0x6103), .driver_info = + USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL }, + ++ /* Silicon Motion Flash Drive */ ++ { USB_DEVICE(0x090c, 0x1000), .driver_info = USB_QUIRK_DELAY_INIT }, ++ + /* Sound Devices USBPre2 */ + { USB_DEVICE(0x0926, 0x0202), .driver_info = + USB_QUIRK_ENDPOINT_IGNORE }, diff --git a/queue-5.10/usb-serial-ftdi_sio-add-support-for-abacus-electrics-optical-probe.patch b/queue-5.10/usb-serial-ftdi_sio-add-support-for-abacus-electrics-optical-probe.patch new file mode 100644 index 0000000000..77a3394182 --- /dev/null +++ b/queue-5.10/usb-serial-ftdi_sio-add-support-for-abacus-electrics-optical-probe.patch @@ -0,0 +1,50 @@ +From b399078f882b6e5d32da18b6c696cc84b12f90d5 Mon Sep 17 00:00:00 2001 +From: Michael Ehrenreich +Date: Mon, 17 Mar 2025 06:17:15 +0100 +Subject: USB: serial: ftdi_sio: add support for Abacus Electrics Optical Probe + +From: Michael Ehrenreich + +commit b399078f882b6e5d32da18b6c696cc84b12f90d5 upstream. + +Abacus Electrics makes optical probes for interacting with smart meters +over an optical interface. + +At least one version uses an FT232B chip (as detected by ftdi_sio) with +a custom USB PID, which needs to be added to the list to make the device +work in a plug-and-play fashion. + +Signed-off-by: Michael Ehrenreich +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/ftdi_sio.c | 2 ++ + drivers/usb/serial/ftdi_sio_ids.h | 5 +++++ + 2 files changed, 7 insertions(+) + +--- a/drivers/usb/serial/ftdi_sio.c ++++ b/drivers/usb/serial/ftdi_sio.c +@@ -1071,6 +1071,8 @@ static const struct usb_device_id id_tab + { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 1) }, + { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 2) }, + { USB_DEVICE_INTERFACE_NUMBER(ALTERA_VID, ALTERA_UB3_602E_PID, 3) }, ++ /* Abacus Electrics */ ++ { USB_DEVICE(FTDI_VID, ABACUS_OPTICAL_PROBE_PID) }, + { } /* Terminating entry */ + }; + +--- a/drivers/usb/serial/ftdi_sio_ids.h ++++ b/drivers/usb/serial/ftdi_sio_ids.h +@@ -436,6 +436,11 @@ + #define LINX_FUTURE_2_PID 0xF44C /* Linx future device */ + + /* ++ * Abacus Electrics ++ */ ++#define ABACUS_OPTICAL_PROBE_PID 0xf458 /* ABACUS ELECTRICS Optical Probe */ ++ ++/* + * Oceanic product ids + */ + #define FTDI_OCEANIC_PID 0xF460 /* Oceanic dive instrument */ diff --git a/queue-5.10/usb-serial-option-add-sierra-wireless-em9291.patch b/queue-5.10/usb-serial-option-add-sierra-wireless-em9291.patch new file mode 100644 index 0000000000..c28dcccce8 --- /dev/null +++ b/queue-5.10/usb-serial-option-add-sierra-wireless-em9291.patch @@ -0,0 +1,63 @@ +From 968e1cbb1f6293c3add9607f80b5ce3d29f57583 Mon Sep 17 00:00:00 2001 +From: Adam Xue +Date: Mon, 14 Apr 2025 14:14:37 -0700 +Subject: USB: serial: option: add Sierra Wireless EM9291 + +From: Adam Xue + +commit 968e1cbb1f6293c3add9607f80b5ce3d29f57583 upstream. + +Add Sierra Wireless EM9291. + +Interface 0: MBIM control + 1: MBIM data + 3: AT port + 4: Diagnostic port + +T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 0 +D: Ver= 2.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=1199 ProdID=90e3 Rev=00.06 +S: Manufacturer=Sierra Wireless, Incorporated +S: Product=Sierra Wireless EM9291 +S: SerialNumber=xxxxxxxxxxxxxxxx +C: #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=500mA +I: If#= 0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim +E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=32ms +I: If#= 1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim +E: Ad=0f(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=8e(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=(none) +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=83(I) Atr=03(Int.) MxPS= 10 Ivl=32ms +I: If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=(none) +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +Signed-off-by: Adam Xue +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/option.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -611,6 +611,7 @@ static void option_instat_callback(struc + /* Sierra Wireless products */ + #define SIERRA_VENDOR_ID 0x1199 + #define SIERRA_PRODUCT_EM9191 0x90d3 ++#define SIERRA_PRODUCT_EM9291 0x90e3 + + /* UNISOC (Spreadtrum) products */ + #define UNISOC_VENDOR_ID 0x1782 +@@ -2432,6 +2433,8 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9191, 0xff, 0, 0) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9291, 0xff, 0xff, 0x30) }, ++ { USB_DEVICE_AND_INTERFACE_INFO(SIERRA_VENDOR_ID, SIERRA_PRODUCT_EM9291, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, + { USB_DEVICE_INTERFACE_CLASS(0x1bbb, 0x0530, 0xff), /* TCL IK512 MBIM */ diff --git a/queue-5.10/usb-serial-simple-add-owon-hds200-series-oscilloscope-support.patch b/queue-5.10/usb-serial-simple-add-owon-hds200-series-oscilloscope-support.patch new file mode 100644 index 0000000000..634b22f4eb --- /dev/null +++ b/queue-5.10/usb-serial-simple-add-owon-hds200-series-oscilloscope-support.patch @@ -0,0 +1,129 @@ +From 4cc01410e1c1dd075df10f750775c81d1cb6672b Mon Sep 17 00:00:00 2001 +From: Craig Hesling +Date: Tue, 8 Apr 2025 16:27:03 -0700 +Subject: USB: serial: simple: add OWON HDS200 series oscilloscope support + +From: Craig Hesling + +commit 4cc01410e1c1dd075df10f750775c81d1cb6672b upstream. + +Add serial support for OWON HDS200 series oscilloscopes and likely +many other pieces of OWON test equipment. + +OWON HDS200 series devices host two USB endpoints, designed to +facilitate bidirectional SCPI. SCPI is a predominately ASCII text +protocol for test/measurement equipment. Having a serial/tty interface +for these devices lowers the barrier to entry for anyone trying to +write programs to communicate with them. + +The following shows the USB descriptor for the OWON HDS272S running +firmware V5.7.1: + +Bus 001 Device 068: ID 5345:1234 Owon PDS6062T Oscilloscope +Negotiated speed: Full Speed (12Mbps) +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 [unknown] + bDeviceSubClass 0 [unknown] + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x5345 Owon + idProduct 0x1234 PDS6062T Oscilloscope + bcdDevice 1.00 + iManufacturer 1 oscilloscope + iProduct 2 oscilloscope + iSerial 3 oscilloscope + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 0x0029 + bNumInterfaces 1 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0x80 + (Bus Powered) + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 2 + bInterfaceClass 5 Physical Interface Device + bInterfaceSubClass 0 [unknown] + bInterfaceProtocol 0 + iInterface 0 + ** UNRECOGNIZED: 09 21 11 01 00 01 22 5f 00 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x81 EP 1 IN + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 32 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x01 EP 1 OUT + bmAttributes 2 + Transfer Type Bulk + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 32 +Device Status: 0x0000 + (Bus Powered) + +OWON appears to be using the same USB Vendor and Product ID for many +of their oscilloscopes. Looking at the discussion about the USB +vendor/product ID, in the link bellow, suggests that this VID/PID is +shared with VDS, SDS, PDS, and now the HDS series oscilloscopes. +Available documentation for these devices seems to indicate that all +use a similar SCPI protocol, some with RS232 options. It is likely that +this same simple serial setup would work correctly for them all. + +Link: https://usb-ids.gowdy.us/read/UD/5345/1234 +Signed-off-by: Craig Hesling +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/usb-serial-simple.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +--- a/drivers/usb/serial/usb-serial-simple.c ++++ b/drivers/usb/serial/usb-serial-simple.c +@@ -101,6 +101,11 @@ DEVICE(nokia, NOKIA_IDS); + { USB_DEVICE(0x09d7, 0x0100) } /* NovAtel FlexPack GPS */ + DEVICE_N(novatel_gps, NOVATEL_IDS, 3); + ++/* OWON electronic test and measurement equipment driver */ ++#define OWON_IDS() \ ++ { USB_DEVICE(0x5345, 0x1234) } /* HDS200 oscilloscopes and others */ ++DEVICE(owon, OWON_IDS); ++ + /* Siemens USB/MPI adapter */ + #define SIEMENS_IDS() \ + { USB_DEVICE(0x908, 0x0004) } +@@ -135,6 +140,7 @@ static struct usb_serial_driver * const + &motorola_tetra_device, + &nokia_device, + &novatel_gps_device, ++ &owon_device, + &siemens_mpi_device, + &suunto_device, + &vivopay_device, +@@ -154,6 +160,7 @@ static const struct usb_device_id id_tab + MOTOROLA_TETRA_IDS(), + NOKIA_IDS(), + NOVATEL_IDS(), ++ OWON_IDS(), + SIEMENS_IDS(), + SUUNTO_IDS(), + VIVOPAY_IDS(), diff --git a/queue-5.10/usb-vli-disk-crashes-if-lpm-is-used.patch b/queue-5.10/usb-vli-disk-crashes-if-lpm-is-used.patch new file mode 100644 index 0000000000..3d984ce2c7 --- /dev/null +++ b/queue-5.10/usb-vli-disk-crashes-if-lpm-is-used.patch @@ -0,0 +1,31 @@ +From e00b39a4f3552c730f1e24c8d62c4a8c6aad4e5d Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Tue, 8 Apr 2025 15:57:46 +0200 +Subject: USB: VLI disk crashes if LPM is used + +From: Oliver Neukum + +commit e00b39a4f3552c730f1e24c8d62c4a8c6aad4e5d upstream. + +This device needs the NO_LPM quirk. + +Cc: stable +Signed-off-by: Oliver Neukum +Link: https://lore.kernel.org/r/20250408135800.792515-1-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/quirks.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/usb/core/quirks.c ++++ b/drivers/usb/core/quirks.c +@@ -540,6 +540,9 @@ static const struct usb_device_id usb_qu + { USB_DEVICE(0x2040, 0x7200), .driver_info = + USB_QUIRK_CONFIG_INTF_STRINGS }, + ++ /* VLI disk */ ++ { USB_DEVICE(0x2109, 0x0711), .driver_info = USB_QUIRK_NO_LPM }, ++ + /* Raydium Touchscreen */ + { USB_DEVICE(0x2386, 0x3114), .driver_info = USB_QUIRK_NO_LPM }, +