From 733d2a8419e242b9701b7a0a10a54a10fb3fa09f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 6 Jun 2022 09:27:53 +0200 Subject: [PATCH] 5.10-stable patches added patches: alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch parisc-stifb-implement-fb_is_primary_device.patch riscv-fix-irq_work-when-smp-is-disabled.patch riscv-initialize-thread-pointer-before-calling-c-functions.patch usb-core-hcd-add-support-for-deferring-roothub-registration.patch usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch usb-new-quirk-for-dell-gen-2-devices.patch usb-serial-option-add-quectel-bg95-modem.patch --- ...r-output-for-dell-xps-15-9520-laptop.patch | 35 +++++ ...rophone-noise-on-asus-tuf-b550m-plus.patch | 68 ++++++++++ ...ing-work-at-closing-a-midi-substream.patch | 36 ++++++ ...stifb-implement-fb_is_primary_device.patch | 87 +++++++++++++ ...cv-fix-irq_work-when-smp-is-disabled.patch | 36 ++++++ ...d-pointer-before-calling-c-functions.patch | 35 +++++ queue-5.10/series | 10 ++ ...t-for-deferring-roothub-registration.patch | 122 ++++++++++++++++++ ...ve-null-pinter-check-to-proper-place.patch | 71 ++++++++++ ...usb-new-quirk-for-dell-gen-2-devices.patch | 34 +++++ ...serial-option-add-quectel-bg95-modem.patch | 115 +++++++++++++++++ 11 files changed, 649 insertions(+) create mode 100644 queue-5.10/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch create mode 100644 queue-5.10/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch create mode 100644 queue-5.10/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch create mode 100644 queue-5.10/parisc-stifb-implement-fb_is_primary_device.patch create mode 100644 queue-5.10/riscv-fix-irq_work-when-smp-is-disabled.patch create mode 100644 queue-5.10/riscv-initialize-thread-pointer-before-calling-c-functions.patch create mode 100644 queue-5.10/usb-core-hcd-add-support-for-deferring-roothub-registration.patch create mode 100644 queue-5.10/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch create mode 100644 queue-5.10/usb-new-quirk-for-dell-gen-2-devices.patch create mode 100644 queue-5.10/usb-serial-option-add-quectel-bg95-modem.patch diff --git a/queue-5.10/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch b/queue-5.10/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch new file mode 100644 index 00000000000..581536e7c2b --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch @@ -0,0 +1,35 @@ +From 15dad62f4bdb5dc0f0efde8181d680db9963544c Mon Sep 17 00:00:00 2001 +From: Rik van der Kemp +Date: Fri, 27 May 2022 14:07:26 +0200 +Subject: ALSA: hda/realtek: Enable 4-speaker output for Dell XPS 15 9520 laptop + +From: Rik van der Kemp + +commit 15dad62f4bdb5dc0f0efde8181d680db9963544c upstream. + +The 2022-model XPS 15 appears to use the same 4-speakers-on-ALC289 +audio setup as the Dell XPS 15 9510, so requires the same quirk to +enable woofer output. Tested on my own 9520. + +[ Move the entry to the right position in the SSID order -- tiwai ] + +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216035 +Cc: +Signed-off-by: Rik van der Kemp +Link: https://lore.kernel.org/r/181056a137b.d14baf90133058.8425453735588429828@upto11.nl +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -8651,6 +8651,7 @@ static const struct snd_pci_quirk alc269 + SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE), ++ SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK), + SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), diff --git a/queue-5.10/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch b/queue-5.10/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch new file mode 100644 index 00000000000..6ca62f50621 --- /dev/null +++ b/queue-5.10/alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch @@ -0,0 +1,68 @@ +From 9bfa7b36343c7d84370bc61c9ed774635b05e4eb Mon Sep 17 00:00:00 2001 +From: Marios Levogiannis +Date: Mon, 30 May 2022 10:41:31 +0300 +Subject: ALSA: hda/realtek - Fix microphone noise on ASUS TUF B550M-PLUS + +From: Marios Levogiannis + +commit 9bfa7b36343c7d84370bc61c9ed774635b05e4eb upstream. + +Set microphone pins 0x18 (rear) and 0x19 (front) to VREF_50 to fix the +microphone noise on ASUS TUF B550M-PLUS which uses the ALCS1200A codec. +The initial value was VREF_80. + +The same issue is also present on Windows using both the default Windows +driver and all tested Realtek drivers before version 6.0.9049.1. Comparing +Realtek driver 6.0.9049.1 (the first one without the microphone noise) to +Realtek driver 6.0.9047.1 (the last one with the microphone noise) +revealed that the fix is the result of setting pins 0x18 and 0x19 to +VREF_50. + +This fix may also work for other boards that have been reported to have +the same microphone issue and use the ALC1150 and ALCS1200A codecs, since +these codecs are similar and the fix in the Realtek driver on Windows is +common for both. However, it is currently enabled only for ASUS TUF +B550M-PLUS as this is the only board that could be tested. + +Signed-off-by: Marios Levogiannis +Cc: +Link: https://lore.kernel.org/r/20220530074131.12258-1-marios.levogiannis@gmail.com +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/pci/hda/patch_realtek.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -1990,6 +1990,7 @@ enum { + ALC1220_FIXUP_CLEVO_PB51ED_PINS, + ALC887_FIXUP_ASUS_AUDIO, + ALC887_FIXUP_ASUS_HMIC, ++ ALCS1200A_FIXUP_MIC_VREF, + }; + + static void alc889_fixup_coef(struct hda_codec *codec, +@@ -2535,6 +2536,14 @@ static const struct hda_fixup alc882_fix + .chained = true, + .chain_id = ALC887_FIXUP_ASUS_AUDIO, + }, ++ [ALCS1200A_FIXUP_MIC_VREF] = { ++ .type = HDA_FIXUP_PINCTLS, ++ .v.pins = (const struct hda_pintbl[]) { ++ { 0x18, PIN_VREF50 }, /* rear mic */ ++ { 0x19, PIN_VREF50 }, /* front mic */ ++ {} ++ } ++ }, + }; + + static const struct snd_pci_quirk alc882_fixup_tbl[] = { +@@ -2572,6 +2581,7 @@ static const struct snd_pci_quirk alc882 + SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), + SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS), + SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3), ++ SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF), + SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), + SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP), + SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), diff --git a/queue-5.10/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch b/queue-5.10/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch new file mode 100644 index 00000000000..9a255a1f6b3 --- /dev/null +++ b/queue-5.10/alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch @@ -0,0 +1,36 @@ +From 0125de38122f0f66bf61336158d12a1aabfe6425 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Wed, 25 May 2022 15:12:03 +0200 +Subject: ALSA: usb-audio: Cancel pending work at closing a MIDI substream + +From: Takashi Iwai + +commit 0125de38122f0f66bf61336158d12a1aabfe6425 upstream. + +At closing a USB MIDI output substream, there might be still a pending +work, which would eventually access the rawmidi runtime object that is +being released. For fixing the race, make sure to cancel the pending +work at closing. + +Reported-by: syzbot+6912c9592caca7ca0e7d@syzkaller.appspotmail.com +Cc: +Link: https://lore.kernel.org/r/000000000000e7e75005dfd07cf6@google.com +Link: https://lore.kernel.org/r/20220525131203.11299-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman +--- + sound/usb/midi.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/sound/usb/midi.c ++++ b/sound/usb/midi.c +@@ -1161,6 +1161,9 @@ static int snd_usbmidi_output_open(struc + + static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) + { ++ struct usbmidi_out_port *port = substream->runtime->private_data; ++ ++ cancel_work_sync(&port->ep->work); + return substream_open(substream, 0, 0); + } + diff --git a/queue-5.10/parisc-stifb-implement-fb_is_primary_device.patch b/queue-5.10/parisc-stifb-implement-fb_is_primary_device.patch new file mode 100644 index 00000000000..770efeef0a5 --- /dev/null +++ b/queue-5.10/parisc-stifb-implement-fb_is_primary_device.patch @@ -0,0 +1,87 @@ +From cf936af790a3ef5f41ff687ec91bfbffee141278 Mon Sep 17 00:00:00 2001 +From: Helge Deller +Date: Thu, 2 Jun 2022 13:50:44 +0200 +Subject: parisc/stifb: Implement fb_is_primary_device() + +From: Helge Deller + +commit cf936af790a3ef5f41ff687ec91bfbffee141278 upstream. + +Implement fb_is_primary_device() function, so that fbcon detects if this +framebuffer belongs to the default graphics card which was used to start +the system. + +Signed-off-by: Helge Deller +Cc: stable@vger.kernel.org # v5.10+ +Signed-off-by: Greg Kroah-Hartman +--- + arch/parisc/include/asm/fb.h | 4 ++++ + drivers/video/console/sticore.c | 17 +++++++++++++++++ + drivers/video/fbdev/stifb.c | 4 ++-- + 3 files changed, 23 insertions(+), 2 deletions(-) + +--- a/arch/parisc/include/asm/fb.h ++++ b/arch/parisc/include/asm/fb.h +@@ -12,9 +12,13 @@ static inline void fb_pgprotect(struct f + pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE; + } + ++#if defined(CONFIG_STI_CONSOLE) || defined(CONFIG_FB_STI) ++int fb_is_primary_device(struct fb_info *info); ++#else + static inline int fb_is_primary_device(struct fb_info *info) + { + return 0; + } ++#endif + + #endif /* _ASM_FB_H_ */ +--- a/drivers/video/console/sticore.c ++++ b/drivers/video/console/sticore.c +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + + #include "../fbdev/sticore.h" + +@@ -1127,6 +1128,22 @@ int sti_call(const struct sti_struct *st + return ret; + } + ++/* check if given fb_info is the primary device */ ++int fb_is_primary_device(struct fb_info *info) ++{ ++ struct sti_struct *sti; ++ ++ sti = sti_get_rom(0); ++ ++ /* if no built-in graphics card found, allow any fb driver as default */ ++ if (!sti) ++ return true; ++ ++ /* return true if it's the default built-in framebuffer driver */ ++ return (sti->info == info); ++} ++EXPORT_SYMBOL(fb_is_primary_device); ++ + MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer"); + MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines"); + MODULE_LICENSE("GPL v2"); +--- a/drivers/video/fbdev/stifb.c ++++ b/drivers/video/fbdev/stifb.c +@@ -1317,11 +1317,11 @@ static int __init stifb_init_fb(struct s + goto out_err3; + } + ++ /* save for primary gfx device detection & unregister_framebuffer() */ ++ sti->info = info; + if (register_framebuffer(&fb->info) < 0) + goto out_err4; + +- sti->info = info; /* save for unregister_framebuffer() */ +- + fb_info(&fb->info, "%s %dx%d-%d frame buffer device, %s, id: %04x, mmio: 0x%04lx\n", + fix->id, + var->xres, diff --git a/queue-5.10/riscv-fix-irq_work-when-smp-is-disabled.patch b/queue-5.10/riscv-fix-irq_work-when-smp-is-disabled.patch new file mode 100644 index 00000000000..bbcce784382 --- /dev/null +++ b/queue-5.10/riscv-fix-irq_work-when-smp-is-disabled.patch @@ -0,0 +1,36 @@ +From 2273272823db6f67d57761df8116ae32e7f05bed Mon Sep 17 00:00:00 2001 +From: Samuel Holland +Date: Fri, 29 Apr 2022 22:00:23 -0500 +Subject: riscv: Fix irq_work when SMP is disabled + +From: Samuel Holland + +commit 2273272823db6f67d57761df8116ae32e7f05bed upstream. + +irq_work is triggered via an IPI, but the IPI infrastructure is not +included in uniprocessor kernels. As a result, irq_work never runs. +Fall back to the tick-based irq_work implementation on uniprocessor +configurations. + +Fixes: 298447928bb1 ("riscv: Support irq_work via self IPIs") +Signed-off-by: Samuel Holland +Reviewed-by: Heiko Stuebner +Link: https://lore.kernel.org/r/20220430030025.58405-1-samuel@sholland.org +Cc: stable@vger.kernel.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/include/asm/irq_work.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/riscv/include/asm/irq_work.h ++++ b/arch/riscv/include/asm/irq_work.h +@@ -4,7 +4,7 @@ + + static inline bool arch_irq_work_has_interrupt(void) + { +- return true; ++ return IS_ENABLED(CONFIG_SMP); + } + extern void arch_irq_work_raise(void); + #endif /* _ASM_RISCV_IRQ_WORK_H */ diff --git a/queue-5.10/riscv-initialize-thread-pointer-before-calling-c-functions.patch b/queue-5.10/riscv-initialize-thread-pointer-before-calling-c-functions.patch new file mode 100644 index 00000000000..3ba31009a5f --- /dev/null +++ b/queue-5.10/riscv-initialize-thread-pointer-before-calling-c-functions.patch @@ -0,0 +1,35 @@ +From 35d33c76d68dfacc330a8eb477b51cc647c5a847 Mon Sep 17 00:00:00 2001 +From: Alexandre Ghiti +Date: Mon, 6 Dec 2021 11:46:56 +0100 +Subject: riscv: Initialize thread pointer before calling C functions + +From: Alexandre Ghiti + +commit 35d33c76d68dfacc330a8eb477b51cc647c5a847 upstream. + +Because of the stack canary feature that reads from the current task +structure the stack canary value, the thread pointer register "tp" must +be set before calling any C function from head.S: by chance, setup_vm +and all the functions that it calls does not seem to be part of the +functions where the canary check is done, but in the following commits, +some functions will. + +Fixes: f2c9699f65557a31 ("riscv: Add STACKPROTECTOR supported") +Signed-off-by: Alexandre Ghiti +Cc: stable@vger.kernel.org +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/kernel/head.S | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/riscv/kernel/head.S ++++ b/arch/riscv/kernel/head.S +@@ -261,6 +261,7 @@ clear_bss_done: + REG_S a0, (a2) + + /* Initialize page tables and relocate to virtual addresses */ ++ la tp, init_task + la sp, init_thread_union + THREAD_SIZE + mv a0, s1 + call setup_vm diff --git a/queue-5.10/series b/queue-5.10/series index 900d9e2fd64..cf83154b5f0 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -1,2 +1,12 @@ arm64-initialize-jump-labels-before-setup_machine_fdt.patch binfmt_flat-do-not-stop-relocating-got-entries-prematurely-on-riscv.patch +parisc-stifb-implement-fb_is_primary_device.patch +riscv-initialize-thread-pointer-before-calling-c-functions.patch +riscv-fix-irq_work-when-smp-is-disabled.patch +alsa-hda-realtek-enable-4-speaker-output-for-dell-xps-15-9520-laptop.patch +alsa-hda-realtek-fix-microphone-noise-on-asus-tuf-b550m-plus.patch +alsa-usb-audio-cancel-pending-work-at-closing-a-midi-substream.patch +usb-serial-option-add-quectel-bg95-modem.patch +usb-new-quirk-for-dell-gen-2-devices.patch +usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch +usb-core-hcd-add-support-for-deferring-roothub-registration.patch diff --git a/queue-5.10/usb-core-hcd-add-support-for-deferring-roothub-registration.patch b/queue-5.10/usb-core-hcd-add-support-for-deferring-roothub-registration.patch new file mode 100644 index 00000000000..6500fc7a6ea --- /dev/null +++ b/queue-5.10/usb-core-hcd-add-support-for-deferring-roothub-registration.patch @@ -0,0 +1,122 @@ +From a44623d9279086c89f631201d993aa332f7c9e66 Mon Sep 17 00:00:00 2001 +From: Kishon Vijay Abraham I +Date: Tue, 10 May 2022 14:46:29 +0530 +Subject: usb: core: hcd: Add support for deferring roothub registration + +From: Kishon Vijay Abraham I + +commit a44623d9279086c89f631201d993aa332f7c9e66 upstream. + +It has been observed with certain PCIe USB cards (like Inateck connected +to AM64 EVM or J7200 EVM) that as soon as the primary roothub is +registered, port status change is handled even before xHC is running +leading to cold plug USB devices not detected. For such cases, registering +both the root hubs along with the second HCD is required. Add support for +deferring roothub registration in usb_add_hcd(), so that both primary and +secondary roothubs are registered along with the second HCD. + +This patch has been added and reverted earier as it triggered a race +in usb device enumeration. +That race is now fixed in 5.16-rc3, and in stable back to 5.4 +commit 6cca13de26ee ("usb: hub: Fix locking issues with address0_mutex") +commit 6ae6dc22d2d1 ("usb: hub: Fix usb enumeration issue due to address0 +race") + +CC: stable@vger.kernel.org # 5.4+ +Suggested-by: Mathias Nyman +Tested-by: Chris Chiu +Acked-by: Alan Stern +Signed-off-by: Kishon Vijay Abraham I +Link: https://lore.kernel.org/r/20220510091630.16564-2-kishon@ti.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/core/hcd.c | 29 +++++++++++++++++++++++------ + include/linux/usb/hcd.h | 2 ++ + 2 files changed, 25 insertions(+), 6 deletions(-) + +--- a/drivers/usb/core/hcd.c ++++ b/drivers/usb/core/hcd.c +@@ -2661,6 +2661,7 @@ int usb_add_hcd(struct usb_hcd *hcd, + { + int retval; + struct usb_device *rhdev; ++ struct usb_hcd *shared_hcd; + + if (!hcd->skip_phy_initialization && usb_hcd_is_primary_hcd(hcd)) { + hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev); +@@ -2817,13 +2818,26 @@ int usb_add_hcd(struct usb_hcd *hcd, + goto err_hcd_driver_start; + } + ++ /* starting here, usbcore will pay attention to the shared HCD roothub */ ++ shared_hcd = hcd->shared_hcd; ++ if (!usb_hcd_is_primary_hcd(hcd) && shared_hcd && HCD_DEFER_RH_REGISTER(shared_hcd)) { ++ retval = register_root_hub(shared_hcd); ++ if (retval != 0) ++ goto err_register_root_hub; ++ ++ if (shared_hcd->uses_new_polling && HCD_POLL_RH(shared_hcd)) ++ usb_hcd_poll_rh_status(shared_hcd); ++ } ++ + /* starting here, usbcore will pay attention to this root hub */ +- retval = register_root_hub(hcd); +- if (retval != 0) +- goto err_register_root_hub; ++ if (!HCD_DEFER_RH_REGISTER(hcd)) { ++ retval = register_root_hub(hcd); ++ if (retval != 0) ++ goto err_register_root_hub; + +- if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) +- usb_hcd_poll_rh_status(hcd); ++ if (hcd->uses_new_polling && HCD_POLL_RH(hcd)) ++ usb_hcd_poll_rh_status(hcd); ++ } + + return retval; + +@@ -2866,6 +2880,7 @@ EXPORT_SYMBOL_GPL(usb_add_hcd); + void usb_remove_hcd(struct usb_hcd *hcd) + { + struct usb_device *rhdev = hcd->self.root_hub; ++ bool rh_registered; + + dev_info(hcd->self.controller, "remove, state %x\n", hcd->state); + +@@ -2876,6 +2891,7 @@ void usb_remove_hcd(struct usb_hcd *hcd) + + dev_dbg(hcd->self.controller, "roothub graceful disconnect\n"); + spin_lock_irq (&hcd_root_hub_lock); ++ rh_registered = hcd->rh_registered; + hcd->rh_registered = 0; + spin_unlock_irq (&hcd_root_hub_lock); + +@@ -2885,7 +2901,8 @@ void usb_remove_hcd(struct usb_hcd *hcd) + cancel_work_sync(&hcd->died_work); + + mutex_lock(&usb_bus_idr_lock); +- usb_disconnect(&rhdev); /* Sets rhdev to NULL */ ++ if (rh_registered) ++ usb_disconnect(&rhdev); /* Sets rhdev to NULL */ + mutex_unlock(&usb_bus_idr_lock); + + /* +--- a/include/linux/usb/hcd.h ++++ b/include/linux/usb/hcd.h +@@ -124,6 +124,7 @@ struct usb_hcd { + #define HCD_FLAG_RH_RUNNING 5 /* root hub is running? */ + #define HCD_FLAG_DEAD 6 /* controller has died? */ + #define HCD_FLAG_INTF_AUTHORIZED 7 /* authorize interfaces? */ ++#define HCD_FLAG_DEFER_RH_REGISTER 8 /* Defer roothub registration */ + + /* The flags can be tested using these macros; they are likely to + * be slightly faster than test_bit(). +@@ -134,6 +135,7 @@ struct usb_hcd { + #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) + #define HCD_RH_RUNNING(hcd) ((hcd)->flags & (1U << HCD_FLAG_RH_RUNNING)) + #define HCD_DEAD(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEAD)) ++#define HCD_DEFER_RH_REGISTER(hcd) ((hcd)->flags & (1U << HCD_FLAG_DEFER_RH_REGISTER)) + + /* + * Specifies if interfaces are authorized by default diff --git a/queue-5.10/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch b/queue-5.10/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch new file mode 100644 index 00000000000..228fb7d0318 --- /dev/null +++ b/queue-5.10/usb-dwc3-gadget-move-null-pinter-check-to-proper-place.patch @@ -0,0 +1,71 @@ +From 3c5880745b4439ac64eccdb040e37fc1cc4c5406 Mon Sep 17 00:00:00 2001 +From: Albert Wang +Date: Wed, 18 May 2022 14:13:15 +0800 +Subject: usb: dwc3: gadget: Move null pinter check to proper place + +From: Albert Wang + +commit 3c5880745b4439ac64eccdb040e37fc1cc4c5406 upstream. + +When dwc3_gadget_ep_cleanup_completed_requests() called to +dwc3_gadget_giveback() where the dwc3 lock is released, other thread is +able to execute. In this situation, usb_ep_disable() gets the chance to +clear endpoint descriptor pointer which leds to the null pointer +dereference problem. So needs to move the null pointer check to a proper +place. + +Example call stack: + +Thread#1: +dwc3_thread_interrupt() + spin_lock + -> dwc3_process_event_buf() + -> dwc3_process_event_entry() + -> dwc3_endpoint_interrupt() + -> dwc3_gadget_endpoint_trbs_complete() + -> dwc3_gadget_ep_cleanup_completed_requests() + ... + -> dwc3_giveback() + spin_unlock + Thread#2 executes + +Thread#2: +configfs_composite_disconnect() + -> __composite_disconnect() + -> ffs_func_disable() + -> ffs_func_set_alt() + -> ffs_func_eps_disable() + -> usb_ep_disable() + wait for dwc3 spin_lock + Thread#1 released lock + clear endpoint.desc + +Fixes: 26288448120b ("usb: dwc3: gadget: Fix null pointer exception") +Cc: stable +Signed-off-by: Albert Wang +Link: https://lore.kernel.org/r/20220518061315.3359198-1-albertccwang@google.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/gadget.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/usb/dwc3/gadget.c ++++ b/drivers/usb/dwc3/gadget.c +@@ -2960,14 +2960,14 @@ static bool dwc3_gadget_endpoint_trbs_co + struct dwc3 *dwc = dep->dwc; + bool no_started_trb = true; + +- if (!dep->endpoint.desc) +- return no_started_trb; +- + dwc3_gadget_ep_cleanup_completed_requests(dep, event, status); + + if (dep->flags & DWC3_EP_END_TRANSFER_PENDING) + goto out; + ++ if (!dep->endpoint.desc) ++ return no_started_trb; ++ + if (usb_endpoint_xfer_isoc(dep->endpoint.desc) && + list_empty(&dep->started_list) && + (list_empty(&dep->pending_list) || status == -EXDEV)) diff --git a/queue-5.10/usb-new-quirk-for-dell-gen-2-devices.patch b/queue-5.10/usb-new-quirk-for-dell-gen-2-devices.patch new file mode 100644 index 00000000000..d01ed76c60b --- /dev/null +++ b/queue-5.10/usb-new-quirk-for-dell-gen-2-devices.patch @@ -0,0 +1,34 @@ +From 97fa5887cf283bb75ffff5f6b2c0e71794c02400 Mon Sep 17 00:00:00 2001 +From: Monish Kumar R +Date: Fri, 20 May 2022 18:30:44 +0530 +Subject: USB: new quirk for Dell Gen 2 devices + +From: Monish Kumar R + +commit 97fa5887cf283bb75ffff5f6b2c0e71794c02400 upstream. + +Add USB_QUIRK_NO_LPM and USB_QUIRK_RESET_RESUME quirks for Dell usb gen +2 device to not fail during enumeration. + +Found this bug on own testing + +Signed-off-by: Monish Kumar R +Cc: stable +Link: https://lore.kernel.org/r/20220520130044.17303-1-monish.kumar.r@intel.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 +@@ -511,6 +511,9 @@ static const struct usb_device_id usb_qu + /* DJI CineSSD */ + { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, + ++ /* DELL USB GEN2 */ ++ { USB_DEVICE(0x413c, 0xb062), .driver_info = USB_QUIRK_NO_LPM | USB_QUIRK_RESET_RESUME }, ++ + /* VCOM device */ + { USB_DEVICE(0x4296, 0x7570), .driver_info = USB_QUIRK_CONFIG_INTF_STRINGS }, + diff --git a/queue-5.10/usb-serial-option-add-quectel-bg95-modem.patch b/queue-5.10/usb-serial-option-add-quectel-bg95-modem.patch new file mode 100644 index 00000000000..5954b1a0f8b --- /dev/null +++ b/queue-5.10/usb-serial-option-add-quectel-bg95-modem.patch @@ -0,0 +1,115 @@ +From 33b7af2f459df453feb0d44628d820c47fefe7a8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Carl=20Yin=28=E6=AE=B7=E5=BC=A0=E6=88=90=29?= + +Date: Thu, 19 May 2022 02:34:43 +0000 +Subject: USB: serial: option: add Quectel BG95 modem + +From: Carl Yin(殷张成) + +commit 33b7af2f459df453feb0d44628d820c47fefe7a8 upstream. + +The BG95 modem has 3 USB configurations that are configurable via the AT +command AT+QCFGEXT="usbnet",["ecm"|"modem"|"rmnet"] which make the modem +enumerate with the following interfaces, respectively: + +"modem": Diag + GNSS + Modem + Modem +"ecm" : Diag + GNSS + Modem + ECM +"rmnet": Diag + GNSS + Modem + QMI + Don't support Full QMI messages (e.g WDS_START_NETWORK_INTERFACE) + +A detailed description of the USB configuration for each mode follows: + ++QCFGEXT: "usbnet","modem" +-------------------------- +T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 3 Spd=480 MxCh= 0 +D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=2c7c ProdID=0700 Rev= 0.00 +S: Manufacturer=Quectel, Incorporated +S: Product=Quectel LPWA Module +S: SerialNumber=884328a2 +C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=fe Prot=ff Driver=option +E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms + ++QCFGEXT: "usbnet","ecm" +------------------------ +T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 +D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1 +P: Vendor=2c7c ProdID=0700 Rev= 0.00 +S: Manufacturer=Quectel, Incorporated +S: Product=Quectel LPWA Module +S: SerialNumber=884328a2 +C:* #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA +A: FirstIf#= 3 IfCount= 2 Cls=02(comm.) Sub=00 Prot=00 +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=06 Prot=00 Driver=cdc_ether +E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +I: If#= 4 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether +I:* If#= 4 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=00 Driver=cdc_ether +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms + ++QCFGEXT: "usbnet","rmnet" +-------------------------- +T: Bus=01 Lev=02 Prnt=02 Port=01 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 +D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 +P: Vendor=2c7c ProdID=0700 Rev= 0.00 +S: Manufacturer=Quectel, Incorporated +S: Product=Quectel LPWA Module +S: SerialNumber=884328a2 +C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA +I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option +E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms +I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan +E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms +E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms +E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms + +Signed-off-by: Carl Yin +Cc: stable@vger.kernel.org +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/serial/option.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -1137,6 +1137,8 @@ static const struct usb_device_id option + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EM12, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0xff, 0x30) }, /* EM160R-GL */ + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, 0x0620, 0xff, 0, 0) }, ++ { USB_DEVICE_INTERFACE_CLASS(QUECTEL_VENDOR_ID, 0x0700, 0xff), /* BG95 */ ++ .driver_info = RSVD(3) | ZLP }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500Q, 0xff, 0xff, 0x10), -- 2.47.3