From: Greg Kroah-Hartman Date: Mon, 14 Oct 2024 10:31:11 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.10.227~42 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b57e0590f9eecc1aa0bd04bd097f38bc645c0905;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: hid-intel-ish-hid-fix-uninitialized-variable-rv-in-ish_fw_xfer_direct_dma.patch hid-plantronics-workaround-for-an-unexcepted-opposite-volume-key.patch revert-usb-yurex-replace-snprintf-with-the-safer-scnprintf-variant.patch usb-dwc3-core-stop-processing-of-pending-events-if-controller-is-halted.patch usb-storage-ignore-bogus-device-raised-by-jieli-br21-usb-sound-chip.patch usb-xhci-fix-problem-with-xhci-resume-from-suspend.patch --- diff --git a/queue-5.10/hid-intel-ish-hid-fix-uninitialized-variable-rv-in-ish_fw_xfer_direct_dma.patch b/queue-5.10/hid-intel-ish-hid-fix-uninitialized-variable-rv-in-ish_fw_xfer_direct_dma.patch new file mode 100644 index 00000000000..05e735d922d --- /dev/null +++ b/queue-5.10/hid-intel-ish-hid-fix-uninitialized-variable-rv-in-ish_fw_xfer_direct_dma.patch @@ -0,0 +1,37 @@ +From d41bff05a61fb539f21e9bf0d39fac77f457434e Mon Sep 17 00:00:00 2001 +From: SurajSonawane2415 +Date: Fri, 4 Oct 2024 13:29:44 +0530 +Subject: hid: intel-ish-hid: Fix uninitialized variable 'rv' in ish_fw_xfer_direct_dma + +From: SurajSonawane2415 + +commit d41bff05a61fb539f21e9bf0d39fac77f457434e upstream. + +Fix the uninitialized symbol 'rv' in the function ish_fw_xfer_direct_dma +to resolve the following warning from the smatch tool: +drivers/hid/intel-ish-hid/ishtp-fw-loader.c:714 ish_fw_xfer_direct_dma() +error: uninitialized symbol 'rv'. +Initialize 'rv' to 0 to prevent undefined behavior from uninitialized +access. + +Cc: stable@vger.kernel.org +Fixes: 91b228107da3 ("HID: intel-ish-hid: ISH firmware loader client driver") +Signed-off-by: SurajSonawane2415 +Link: https://patch.msgid.link/20241004075944.44932-1-surajsonawane0215@gmail.com +Signed-off-by: Benjamin Tissoires +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/hid/intel-ish-hid/ishtp-fw-loader.c ++++ b/drivers/hid/intel-ish-hid/ishtp-fw-loader.c +@@ -630,7 +630,7 @@ static int ish_fw_xfer_direct_dma(struct + const struct firmware *fw, + const struct shim_fw_info fw_info) + { +- int rv; ++ int rv = 0; + void *dma_buf; + dma_addr_t dma_buf_phy; + u32 fragment_offset, fragment_size, payload_max_size; diff --git a/queue-5.10/hid-plantronics-workaround-for-an-unexcepted-opposite-volume-key.patch b/queue-5.10/hid-plantronics-workaround-for-an-unexcepted-opposite-volume-key.patch new file mode 100644 index 00000000000..6f2ad3bf3d8 --- /dev/null +++ b/queue-5.10/hid-plantronics-workaround-for-an-unexcepted-opposite-volume-key.patch @@ -0,0 +1,91 @@ +From 87b696209007b7c4ef7bdfe39ea0253404a43770 Mon Sep 17 00:00:00 2001 +From: Wade Wang +Date: Mon, 16 Sep 2024 16:56:00 +0800 +Subject: HID: plantronics: Workaround for an unexcepted opposite volume key + +From: Wade Wang + +commit 87b696209007b7c4ef7bdfe39ea0253404a43770 upstream. + +Some Plantronics headset as the below send an unexcept opposite +volume key's HID report for each volume key press after 200ms, like +unecepted Volume Up Key following Volume Down key pressed by user. +This patch adds a quirk to hid-plantronics for these devices, which +will ignore the second unexcepted opposite volume key if it happens +within 220ms from the last one that was handled. + Plantronics EncorePro 500 Series (047f:431e) + Plantronics Blackwire_3325 Series (047f:430c) + +The patch was tested on the mentioned model, it shouldn't affect +other models, however, this quirk might be needed for them too. +Auto-repeat (when a key is held pressed) is not affected per test +result. + +Cc: stable@vger.kernel.org +Signed-off-by: Wade Wang +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/hid-ids.h | 2 ++ + drivers/hid/hid-plantronics.c | 23 +++++++++++++++++++++++ + 2 files changed, 25 insertions(+) + +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -963,6 +963,8 @@ + #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056 + #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES 0xc057 + #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES 0xc058 ++#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES 0x430c ++#define USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES 0x431e + + #define USB_VENDOR_ID_PANASONIC 0x04da + #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044 +--- a/drivers/hid/hid-plantronics.c ++++ b/drivers/hid/hid-plantronics.c +@@ -38,8 +38,10 @@ + (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) + + #define PLT_QUIRK_DOUBLE_VOLUME_KEYS BIT(0) ++#define PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS BIT(1) + + #define PLT_DOUBLE_KEY_TIMEOUT 5 /* ms */ ++#define PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT 220 /* ms */ + + struct plt_drv_data { + unsigned long device_type; +@@ -137,6 +139,21 @@ static int plantronics_event(struct hid_ + + drv_data->last_volume_key_ts = cur_ts; + } ++ if (drv_data->quirks & PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS) { ++ unsigned long prev_ts, cur_ts; ++ ++ /* Usages are filtered in plantronics_usages. */ ++ ++ if (!value) /* Handle key presses only. */ ++ return 0; ++ ++ prev_ts = drv_data->last_volume_key_ts; ++ cur_ts = jiffies; ++ if (jiffies_to_msecs(cur_ts - prev_ts) <= PLT_FOLLOWED_OPPOSITE_KEY_TIMEOUT) ++ return 1; /* Ignore the followed opposite volume key. */ ++ ++ drv_data->last_volume_key_ts = cur_ts; ++ } + + return 0; + } +@@ -210,6 +227,12 @@ static const struct hid_device_id plantr + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, + USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES), + .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, ++ USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3325_SERIES), ++ .driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, ++ USB_DEVICE_ID_PLANTRONICS_ENCOREPRO_500_SERIES), ++ .driver_data = PLT_QUIRK_FOLLOWED_OPPOSITE_VOLUME_KEYS }, + { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, + { } + }; diff --git a/queue-5.10/revert-usb-yurex-replace-snprintf-with-the-safer-scnprintf-variant.patch b/queue-5.10/revert-usb-yurex-replace-snprintf-with-the-safer-scnprintf-variant.patch new file mode 100644 index 00000000000..b90fe19fb4b --- /dev/null +++ b/queue-5.10/revert-usb-yurex-replace-snprintf-with-the-safer-scnprintf-variant.patch @@ -0,0 +1,67 @@ +From 71c717cd8a2e180126932cc6851ff21c1d04d69a Mon Sep 17 00:00:00 2001 +From: Oliver Neukum +Date: Mon, 7 Oct 2024 11:39:47 +0200 +Subject: Revert "usb: yurex: Replace snprintf() with the safer scnprintf() variant" + +From: Oliver Neukum + +commit 71c717cd8a2e180126932cc6851ff21c1d04d69a upstream. + +This reverts commit 86b20af11e84c26ae3fde4dcc4f490948e3f8035. + +This patch leads to passing 0 to simple_read_from_buffer() +as a fifth argument, turning the read method into a nop. +The change is fundamentally flawed, as it breaks the driver. + +Signed-off-by: Oliver Neukum +Cc: stable +Link: https://lore.kernel.org/r/20241007094004.242122-1-oneukum@suse.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/misc/yurex.c | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +--- a/drivers/usb/misc/yurex.c ++++ b/drivers/usb/misc/yurex.c +@@ -34,8 +34,6 @@ + #define YUREX_BUF_SIZE 8 + #define YUREX_WRITE_TIMEOUT (HZ*2) + +-#define MAX_S64_STRLEN 20 /* {-}922337203685477580{7,8} */ +- + /* table of devices that work with this driver */ + static struct usb_device_id yurex_table[] = { + { USB_DEVICE(YUREX_VENDOR_ID, YUREX_PRODUCT_ID) }, +@@ -402,7 +400,8 @@ static ssize_t yurex_read(struct file *f + { + struct usb_yurex *dev; + int len = 0; +- char in_buffer[MAX_S64_STRLEN]; ++ char in_buffer[20]; ++ unsigned long flags; + + dev = file->private_data; + +@@ -412,16 +411,14 @@ static ssize_t yurex_read(struct file *f + return -ENODEV; + } + +- if (WARN_ON_ONCE(dev->bbu > S64_MAX || dev->bbu < S64_MIN)) { +- mutex_unlock(&dev->io_mutex); +- return -EIO; +- } +- +- spin_lock_irq(&dev->lock); +- scnprintf(in_buffer, MAX_S64_STRLEN, "%lld\n", dev->bbu); +- spin_unlock_irq(&dev->lock); ++ spin_lock_irqsave(&dev->lock, flags); ++ len = snprintf(in_buffer, 20, "%lld\n", dev->bbu); ++ spin_unlock_irqrestore(&dev->lock, flags); + mutex_unlock(&dev->io_mutex); + ++ if (WARN_ON_ONCE(len >= sizeof(in_buffer))) ++ return -EIO; ++ + return simple_read_from_buffer(buffer, count, ppos, in_buffer, len); + } + diff --git a/queue-5.10/series b/queue-5.10/series index 73a219f447b..e630c787ee2 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -506,3 +506,9 @@ slip-make-slhc_remember-more-robust-against-maliciou.patch resource-fix-region_intersects-vs-add_memory_driver_.patch hwmon-tmp513-add-missing-dependency-on-regmap_i2c.patch hwmon-adm9240-add-missing-dependency-on-regmap_i2c.patch +hid-plantronics-workaround-for-an-unexcepted-opposite-volume-key.patch +revert-usb-yurex-replace-snprintf-with-the-safer-scnprintf-variant.patch +usb-dwc3-core-stop-processing-of-pending-events-if-controller-is-halted.patch +usb-xhci-fix-problem-with-xhci-resume-from-suspend.patch +usb-storage-ignore-bogus-device-raised-by-jieli-br21-usb-sound-chip.patch +hid-intel-ish-hid-fix-uninitialized-variable-rv-in-ish_fw_xfer_direct_dma.patch diff --git a/queue-5.10/usb-dwc3-core-stop-processing-of-pending-events-if-controller-is-halted.patch b/queue-5.10/usb-dwc3-core-stop-processing-of-pending-events-if-controller-is-halted.patch new file mode 100644 index 00000000000..3dcc974f7fe --- /dev/null +++ b/queue-5.10/usb-dwc3-core-stop-processing-of-pending-events-if-controller-is-halted.patch @@ -0,0 +1,124 @@ +From 0d410e8913f5cffebcca79ffdd596009d4a13a28 Mon Sep 17 00:00:00 2001 +From: Selvarasu Ganesan +Date: Tue, 17 Sep 2024 04:48:09 +0530 +Subject: usb: dwc3: core: Stop processing of pending events if controller is halted + +From: Selvarasu Ganesan + +commit 0d410e8913f5cffebcca79ffdd596009d4a13a28 upstream. + +This commit addresses an issue where events were being processed when +the controller was in a halted state. To fix this issue by stop +processing the events as the event count was considered stale or +invalid when the controller was halted. + +Fixes: fc8bb91bc83e ("usb: dwc3: implement runtime PM") +Cc: stable@kernel.org +Signed-off-by: Selvarasu Ganesan +Suggested-by: Thinh Nguyen +Acked-by: Thinh Nguyen +Link: https://lore.kernel.org/r/20240916231813.206-1-selvarasu.g@samsung.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 22 +++++++++++++++++++--- + drivers/usb/dwc3/core.h | 4 ---- + drivers/usb/dwc3/gadget.c | 11 ----------- + 3 files changed, 19 insertions(+), 18 deletions(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -457,6 +457,7 @@ static int dwc3_alloc_event_buffers(stru + int dwc3_event_buffers_setup(struct dwc3 *dwc) + { + struct dwc3_event_buffer *evt; ++ u32 reg; + + if (!dwc->ev_buf) + return 0; +@@ -469,8 +470,10 @@ int dwc3_event_buffers_setup(struct dwc3 + upper_32_bits(evt->dma)); + dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), + DWC3_GEVNTSIZ_SIZE(evt->length)); +- dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0); + ++ /* Clear any stale event */ ++ reg = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); ++ dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), reg); + return 0; + } + +@@ -497,7 +500,10 @@ void dwc3_event_buffers_cleanup(struct d + dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(0), 0); + dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(0), DWC3_GEVNTSIZ_INTMASK + | DWC3_GEVNTSIZ_SIZE(0)); +- dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 0); ++ ++ /* Clear any stale event */ ++ reg = dwc3_readl(dwc->regs, DWC3_GEVNTCOUNT(0)); ++ dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), reg); + } + + static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc) +@@ -1899,7 +1905,11 @@ static int dwc3_runtime_resume(struct de + + switch (dwc->current_dr_role) { + case DWC3_GCTL_PRTCAP_DEVICE: +- dwc3_gadget_process_pending_events(dwc); ++ if (dwc->pending_events) { ++ pm_runtime_put(dwc->dev); ++ dwc->pending_events = false; ++ enable_irq(dwc->irq_gadget); ++ } + break; + case DWC3_GCTL_PRTCAP_HOST: + default: +@@ -1986,6 +1996,12 @@ static void dwc3_complete(struct device + static const struct dev_pm_ops dwc3_dev_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume) + .complete = dwc3_complete, ++ ++ /* ++ * Runtime suspend halts the controller on disconnection. It relies on ++ * platforms with custom connection notification to start the controller ++ * again. ++ */ + SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume, + dwc3_runtime_idle) + }; +--- a/drivers/usb/dwc3/core.h ++++ b/drivers/usb/dwc3/core.h +@@ -1532,7 +1532,6 @@ static inline void dwc3_otg_host_init(st + #if !IS_ENABLED(CONFIG_USB_DWC3_HOST) + int dwc3_gadget_suspend(struct dwc3 *dwc); + int dwc3_gadget_resume(struct dwc3 *dwc); +-void dwc3_gadget_process_pending_events(struct dwc3 *dwc); + #else + static inline int dwc3_gadget_suspend(struct dwc3 *dwc) + { +@@ -1544,9 +1543,6 @@ static inline int dwc3_gadget_resume(str + return 0; + } + +-static inline void dwc3_gadget_process_pending_events(struct dwc3 *dwc) +-{ +-} + #endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */ + + #if IS_ENABLED(CONFIG_USB_DWC3_ULPI) +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -4093,14 +4093,3 @@ err1: + err0: + return ret; + } +- +-void dwc3_gadget_process_pending_events(struct dwc3 *dwc) +-{ +- if (dwc->pending_events) { +- dwc3_interrupt(dwc->irq_gadget, dwc->ev_buf); +- dwc3_thread_interrupt(dwc->irq_gadget, dwc->ev_buf); +- pm_runtime_put(dwc->dev); +- dwc->pending_events = false; +- enable_irq(dwc->irq_gadget); +- } +-} diff --git a/queue-5.10/usb-storage-ignore-bogus-device-raised-by-jieli-br21-usb-sound-chip.patch b/queue-5.10/usb-storage-ignore-bogus-device-raised-by-jieli-br21-usb-sound-chip.patch new file mode 100644 index 00000000000..fc7b159a346 --- /dev/null +++ b/queue-5.10/usb-storage-ignore-bogus-device-raised-by-jieli-br21-usb-sound-chip.patch @@ -0,0 +1,46 @@ +From a6555cb1cb69db479d0760e392c175ba32426842 Mon Sep 17 00:00:00 2001 +From: Icenowy Zheng +Date: Tue, 1 Oct 2024 16:34:07 +0800 +Subject: usb: storage: ignore bogus device raised by JieLi BR21 USB sound chip + +From: Icenowy Zheng + +commit a6555cb1cb69db479d0760e392c175ba32426842 upstream. + +JieLi tends to use SCSI via USB Mass Storage to implement their own +proprietary commands instead of implementing another USB interface. +Enumerating it as a generic mass storage device will lead to a Hardware +Error sense key get reported. + +Ignore this bogus device to prevent appearing a unusable sdX device +file. + +Signed-off-by: Icenowy Zheng +Cc: stable +Acked-by: Alan Stern +Link: https://lore.kernel.org/r/20241001083407.8336-1-uwu@icenowy.me +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/storage/unusual_devs.h | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +--- a/drivers/usb/storage/unusual_devs.h ++++ b/drivers/usb/storage/unusual_devs.h +@@ -2412,6 +2412,17 @@ UNUSUAL_DEV( 0xc251, 0x4003, 0x0100, 0x + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_NOT_LOCKABLE), + ++/* ++ * Reported by Icenowy Zheng ++ * This is an interface for vendor-specific cryptic commands instead ++ * of real USB storage device. ++ */ ++UNUSUAL_DEV( 0xe5b7, 0x0811, 0x0100, 0x0100, ++ "ZhuHai JieLi Technology", ++ "JieLi BR21", ++ USB_SC_DEVICE, USB_PR_DEVICE, NULL, ++ US_FL_IGNORE_DEVICE), ++ + /* Reported by Andrew Simmons */ + UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, + "DataStor", diff --git a/queue-5.10/usb-xhci-fix-problem-with-xhci-resume-from-suspend.patch b/queue-5.10/usb-xhci-fix-problem-with-xhci-resume-from-suspend.patch new file mode 100644 index 00000000000..2c117d6cde8 --- /dev/null +++ b/queue-5.10/usb-xhci-fix-problem-with-xhci-resume-from-suspend.patch @@ -0,0 +1,44 @@ +From d44238d8254a36249d576c96473269dbe500f5e4 Mon Sep 17 00:00:00 2001 +From: Jose Alberto Reguero +Date: Thu, 19 Sep 2024 20:42:02 +0200 +Subject: usb: xhci: Fix problem with xhci resume from suspend + +From: Jose Alberto Reguero + +commit d44238d8254a36249d576c96473269dbe500f5e4 upstream. + +I have a ASUS PN51 S mini pc that has two xhci devices. One from AMD, +and other from ASMEDIA. The one from ASMEDIA have problems when resume +from suspend, and keep broken until unplug the power cord. I use this +kernel parameter: xhci-hcd.quirks=128 and then it works ok. I make a +path to reset only the ASMEDIA xhci. + +Signed-off-by: Jose Alberto Reguero +Cc: stable +Link: https://lore.kernel.org/r/20240919184202.22249-1-jose.alberto.reguero@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci-pci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/usb/host/xhci-pci.c ++++ b/drivers/usb/host/xhci-pci.c +@@ -71,6 +71,7 @@ + #define PCI_DEVICE_ID_ASMEDIA_1042A_XHCI 0x1142 + #define PCI_DEVICE_ID_ASMEDIA_1142_XHCI 0x1242 + #define PCI_DEVICE_ID_ASMEDIA_2142_XHCI 0x2142 ++#define PCI_DEVICE_ID_ASMEDIA_3042_XHCI 0x3042 + #define PCI_DEVICE_ID_ASMEDIA_3242_XHCI 0x3242 + + static const char hcd_name[] = "xhci_hcd"; +@@ -324,6 +325,10 @@ static void xhci_pci_quirks(struct devic + pdev->device == PCI_DEVICE_ID_ASMEDIA_1042A_XHCI) + xhci->quirks |= XHCI_ASMEDIA_MODIFY_FLOWCONTROL; + ++ if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && ++ pdev->device == PCI_DEVICE_ID_ASMEDIA_3042_XHCI) ++ xhci->quirks |= XHCI_RESET_ON_RESUME; ++ + if (pdev->vendor == PCI_VENDOR_ID_TI && pdev->device == 0x8241) + xhci->quirks |= XHCI_LIMIT_ENDPOINT_INTERVAL_7; +