]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Aug 2025 16:37:38 +0000 (18:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Aug 2025 16:37:38 +0000 (18:37 +0200)
added patches:
alsa-intel_hdmi-fix-off-by-one-error-in-__hdmi_lpe_audio_probe.patch
kvm-vmx-allow-guest-to-set-debugctl.rtm_debug-if-rtm-is-supported.patch
mips-mm-tlb-r4k-uniquify-tlb-entries-on-init.patch
mm-hmm-move-pmd_to_hmm_pfn_flags-to-the-respective-ifdeffery.patch
usb-gadget-fix-use-after-free-in-composite_dev_cleanup.patch

queue-5.15/alsa-intel_hdmi-fix-off-by-one-error-in-__hdmi_lpe_audio_probe.patch [new file with mode: 0644]
queue-5.15/bluetooth-btusb-add-usb-id-3625-010b-for-tp-link-archer-tx10ub-nano.patch [deleted file]
queue-5.15/kvm-vmx-allow-guest-to-set-debugctl.rtm_debug-if-rtm-is-supported.patch [new file with mode: 0644]
queue-5.15/mips-mm-tlb-r4k-uniquify-tlb-entries-on-init.patch [new file with mode: 0644]
queue-5.15/mm-hmm-move-pmd_to_hmm_pfn_flags-to-the-respective-ifdeffery.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/usb-gadget-fix-use-after-free-in-composite_dev_cleanup.patch [new file with mode: 0644]

diff --git a/queue-5.15/alsa-intel_hdmi-fix-off-by-one-error-in-__hdmi_lpe_audio_probe.patch b/queue-5.15/alsa-intel_hdmi-fix-off-by-one-error-in-__hdmi_lpe_audio_probe.patch
new file mode 100644 (file)
index 0000000..745795c
--- /dev/null
@@ -0,0 +1,38 @@
+From 8cbe564974248ee980562be02f2b1912769562c7 Mon Sep 17 00:00:00 2001
+From: Thorsten Blum <thorsten.blum@linux.dev>
+Date: Wed, 6 Aug 2025 01:41:53 +0200
+Subject: ALSA: intel_hdmi: Fix off-by-one error in __hdmi_lpe_audio_probe()
+
+From: Thorsten Blum <thorsten.blum@linux.dev>
+
+commit 8cbe564974248ee980562be02f2b1912769562c7 upstream.
+
+In __hdmi_lpe_audio_probe(), strscpy() is incorrectly called with the
+length of the source string (excluding the NUL terminator) rather than
+the size of the destination buffer. This results in one character less
+being copied from 'card->shortname' to 'pcm->name'.
+
+Use the destination buffer size instead to ensure the card name is
+copied correctly.
+
+Cc: stable@vger.kernel.org
+Fixes: 75b1a8f9d62e ("ALSA: Convert strlcpy to strscpy when return value is unused")
+Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
+Link: https://patch.msgid.link/20250805234156.60294-1-thorsten.blum@linux.dev
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/x86/intel_hdmi_audio.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/x86/intel_hdmi_audio.c
++++ b/sound/x86/intel_hdmi_audio.c
+@@ -1769,7 +1769,7 @@ static int __hdmi_lpe_audio_probe(struct
+               /* setup private data which can be retrieved when required */
+               pcm->private_data = ctx;
+               pcm->info_flags = 0;
+-              strscpy(pcm->name, card->shortname, strlen(card->shortname));
++              strscpy(pcm->name, card->shortname, sizeof(pcm->name));
+               /* setup the ops for playback */
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &had_pcm_ops);
diff --git a/queue-5.15/bluetooth-btusb-add-usb-id-3625-010b-for-tp-link-archer-tx10ub-nano.patch b/queue-5.15/bluetooth-btusb-add-usb-id-3625-010b-for-tp-link-archer-tx10ub-nano.patch
deleted file mode 100644 (file)
index 2ab0981..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-From d9da920233ec85af8b9c87154f2721a7dc4623f5 Mon Sep 17 00:00:00 2001
-From: Zenm Chen <zenmchen@gmail.com>
-Date: Wed, 21 May 2025 09:30:20 +0800
-Subject: Bluetooth: btusb: Add USB ID 3625:010b for TP-LINK Archer TX10UB Nano
-
-From: Zenm Chen <zenmchen@gmail.com>
-
-commit d9da920233ec85af8b9c87154f2721a7dc4623f5 upstream.
-
-Add USB ID 3625:010b for TP-LINK Archer TX10UB Nano which is based on
-a Realtek RTL8851BU chip.
-
-The information in /sys/kernel/debug/usb/devices about the Bluetooth
-device is listed as the below:
-
-T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 9 Spd=480 MxCh= 0
-D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 1
-P: Vendor=3625 ProdID=010b Rev= 0.00
-S: Manufacturer=Realtek
-S: Product=802.11ax WLAN Adapter
-S: SerialNumber=00e04c000001
-C:* #Ifs= 3 Cfg#= 1 Atr=e0 MxPwr=500mA
-A: FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
-I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=81(I) Atr=03(Int.) MxPS= 16 Ivl=1ms
-E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 0 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 0 Ivl=1ms
-I: If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 9 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 9 Ivl=1ms
-I: If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 17 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 17 Ivl=1ms
-I: If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 25 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 25 Ivl=1ms
-I: If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 33 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 33 Ivl=1ms
-I: If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 49 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 49 Ivl=1ms
-I: If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
-E: Ad=03(O) Atr=01(Isoc) MxPS= 63 Ivl=1ms
-E: Ad=83(I) Atr=01(Isoc) MxPS= 63 Ivl=1ms
-I:* If#= 2 Alt= 0 #EPs= 8 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl8851bu
-E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=07(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=09(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=0a(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=0b(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-E: Ad=0c(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
-
-Cc: stable@vger.kernel.org
-Signed-off-by: Zenm Chen <zenmchen@gmail.com>
-Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- drivers/bluetooth/btusb.c |    4 ++++
- 1 file changed, 4 insertions(+)
-
---- a/drivers/bluetooth/btusb.c
-+++ b/drivers/bluetooth/btusb.c
-@@ -410,6 +410,10 @@ static const struct usb_device_id blackl
-       { USB_DEVICE(0x0bda, 0xc822), .driver_info = BTUSB_REALTEK |
-                                                    BTUSB_WIDEBAND_SPEECH },
-+      /* Realtek 8851BU Bluetooth devices */
-+      { USB_DEVICE(0x3625, 0x010b), .driver_info = BTUSB_REALTEK |
-+                                                   BTUSB_WIDEBAND_SPEECH },
-+
-       /* Realtek 8852AE Bluetooth devices */
-       { USB_DEVICE(0x0bda, 0x2852), .driver_info = BTUSB_REALTEK |
-                                                    BTUSB_WIDEBAND_SPEECH },
diff --git a/queue-5.15/kvm-vmx-allow-guest-to-set-debugctl.rtm_debug-if-rtm-is-supported.patch b/queue-5.15/kvm-vmx-allow-guest-to-set-debugctl.rtm_debug-if-rtm-is-supported.patch
new file mode 100644 (file)
index 0000000..d8c604e
--- /dev/null
@@ -0,0 +1,55 @@
+From 17ec2f965344ee3fd6620bef7ef68792f4ac3af0 Mon Sep 17 00:00:00 2001
+From: Sean Christopherson <seanjc@google.com>
+Date: Tue, 10 Jun 2025 16:20:06 -0700
+Subject: KVM: VMX: Allow guest to set DEBUGCTL.RTM_DEBUG if RTM is supported
+
+From: Sean Christopherson <seanjc@google.com>
+
+commit 17ec2f965344ee3fd6620bef7ef68792f4ac3af0 upstream.
+
+Let the guest set DEBUGCTL.RTM_DEBUG if RTM is supported according to the
+guest CPUID model, as debug support is supposed to be available if RTM is
+supported, and there are no known downsides to letting the guest debug RTM
+aborts.
+
+Note, there are no known bug reports related to RTM_DEBUG, the primary
+motivation is to reduce the probability of breaking existing guests when a
+future change adds a missing consistency check on vmcs12.GUEST_DEBUGCTL
+(KVM currently lets L2 run with whatever hardware supports; whoops).
+
+Note #2, KVM already emulates DR6.RTM, and doesn't restrict access to
+DR7.RTM.
+
+Fixes: 83c529151ab0 ("KVM: x86: expose Intel cpu new features (HLE, RTM) to guest")
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20250610232010.162191-5-seanjc@google.com
+Signed-off-by: Sean Christopherson <seanjc@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/include/asm/msr-index.h |    1 +
+ arch/x86/kvm/vmx/vmx.c           |    4 ++++
+ 2 files changed, 5 insertions(+)
+
+--- a/arch/x86/include/asm/msr-index.h
++++ b/arch/x86/include/asm/msr-index.h
+@@ -359,6 +359,7 @@
+ #define DEBUGCTLMSR_FREEZE_PERFMON_ON_PMI     (1UL << 12)
+ #define DEBUGCTLMSR_FREEZE_IN_SMM_BIT 14
+ #define DEBUGCTLMSR_FREEZE_IN_SMM     (1UL << DEBUGCTLMSR_FREEZE_IN_SMM_BIT)
++#define DEBUGCTLMSR_RTM_DEBUG         BIT(15)
+ #define MSR_PEBS_FRONTEND             0x000003f7
+--- a/arch/x86/kvm/vmx/vmx.c
++++ b/arch/x86/kvm/vmx/vmx.c
+@@ -2018,6 +2018,10 @@ static u64 vcpu_supported_debugctl(struc
+       if (!guest_cpuid_has(vcpu, X86_FEATURE_BUS_LOCK_DETECT))
+               debugctl &= ~DEBUGCTLMSR_BUS_LOCK_DETECT;
++      if (boot_cpu_has(X86_FEATURE_RTM) &&
++          (host_initiated || guest_cpu_cap_has(vcpu, X86_FEATURE_RTM)))
++              debugctl |= DEBUGCTLMSR_RTM_DEBUG;
++
+       return debugctl;
+ }
diff --git a/queue-5.15/mips-mm-tlb-r4k-uniquify-tlb-entries-on-init.patch b/queue-5.15/mips-mm-tlb-r4k-uniquify-tlb-entries-on-init.patch
new file mode 100644 (file)
index 0000000..b1e42e6
--- /dev/null
@@ -0,0 +1,98 @@
+From 35ad7e181541aa5757f9f316768d3e64403ec843 Mon Sep 17 00:00:00 2001
+From: Jiaxun Yang <jiaxun.yang@flygoat.com>
+Date: Sat, 7 Jun 2025 13:43:56 +0100
+Subject: MIPS: mm: tlb-r4k: Uniquify TLB entries on init
+
+From: Jiaxun Yang <jiaxun.yang@flygoat.com>
+
+commit 35ad7e181541aa5757f9f316768d3e64403ec843 upstream.
+
+Hardware or bootloader will initialize TLB entries to any value, which
+may collide with kernel's UNIQUE_ENTRYHI value. On MIPS microAptiv/M5150
+family of cores this will trigger machine check exception and cause boot
+failure. On M5150 simulation this could happen 7 times out of 1000 boots.
+
+Replace local_flush_tlb_all() with r4k_tlb_uniquify() which probes each
+TLB ENTRIHI unique value for collisions before it's written, and in case
+of collision try a different ASID.
+
+Cc: stable@kernel.org
+Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/mips/mm/tlb-r4k.c |   56 ++++++++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 55 insertions(+), 1 deletion(-)
+
+--- a/arch/mips/mm/tlb-r4k.c
++++ b/arch/mips/mm/tlb-r4k.c
+@@ -498,6 +498,60 @@ static int __init set_ntlb(char *str)
+ __setup("ntlb=", set_ntlb);
++/* Initialise all TLB entries with unique values */
++static void r4k_tlb_uniquify(void)
++{
++      int entry = num_wired_entries();
++
++      htw_stop();
++      write_c0_entrylo0(0);
++      write_c0_entrylo1(0);
++
++      while (entry < current_cpu_data.tlbsize) {
++              unsigned long asid_mask = cpu_asid_mask(&current_cpu_data);
++              unsigned long asid = 0;
++              int idx;
++
++              /* Skip wired MMID to make ginvt_mmid work */
++              if (cpu_has_mmid)
++                      asid = MMID_KERNEL_WIRED + 1;
++
++              /* Check for match before using UNIQUE_ENTRYHI */
++              do {
++                      if (cpu_has_mmid) {
++                              write_c0_memorymapid(asid);
++                              write_c0_entryhi(UNIQUE_ENTRYHI(entry));
++                      } else {
++                              write_c0_entryhi(UNIQUE_ENTRYHI(entry) | asid);
++                      }
++                      mtc0_tlbw_hazard();
++                      tlb_probe();
++                      tlb_probe_hazard();
++                      idx = read_c0_index();
++                      /* No match or match is on current entry */
++                      if (idx < 0 || idx == entry)
++                              break;
++                      /*
++                       * If we hit a match, we need to try again with
++                       * a different ASID.
++                       */
++                      asid++;
++              } while (asid < asid_mask);
++
++              if (idx >= 0 && idx != entry)
++                      panic("Unable to uniquify TLB entry %d", idx);
++
++              write_c0_index(entry);
++              mtc0_tlbw_hazard();
++              tlb_write_indexed();
++              entry++;
++      }
++
++      tlbw_use_hazard();
++      htw_start();
++      flush_micro_tlb();
++}
++
+ /*
+  * Configure TLB (for init or after a CPU has been powered off).
+  */
+@@ -537,7 +591,7 @@ static void r4k_tlb_configure(void)
+       temp_tlb_entry = current_cpu_data.tlbsize - 1;
+       /* From this point on the ARC firmware is dead.  */
+-      local_flush_tlb_all();
++      r4k_tlb_uniquify();
+       /* Did I tell you that ARC SUCKS?  */
+ }
diff --git a/queue-5.15/mm-hmm-move-pmd_to_hmm_pfn_flags-to-the-respective-ifdeffery.patch b/queue-5.15/mm-hmm-move-pmd_to_hmm_pfn_flags-to-the-respective-ifdeffery.patch
new file mode 100644 (file)
index 0000000..03fba9d
--- /dev/null
@@ -0,0 +1,56 @@
+From 188cb385bbf04d486df3e52f28c47b3961f5f0c0 Mon Sep 17 00:00:00 2001
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Date: Thu, 10 Jul 2025 11:23:53 +0300
+Subject: mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+commit 188cb385bbf04d486df3e52f28c47b3961f5f0c0 upstream.
+
+When pmd_to_hmm_pfn_flags() is unused, it prevents kernel builds with
+clang, `make W=1` and CONFIG_TRANSPARENT_HUGEPAGE=n:
+
+  mm/hmm.c:186:29: warning: unused function 'pmd_to_hmm_pfn_flags' [-Wunused-function]
+
+Fix this by moving the function to the respective existing ifdeffery
+for its the only user.
+
+See also:
+
+  6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build")
+
+Link: https://lkml.kernel.org/r/20250710082403.664093-1-andriy.shevchenko@linux.intel.com
+Fixes: 992de9a8b751 ("mm/hmm: allow to mirror vma of a file on a DAX backed filesystem")
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
+Reviewed-by: Alistair Popple <apopple@nvidia.com>
+Cc: Andriy Shevchenko <andriy.shevchenko@linux.intel.com>
+Cc: Bill Wendling <morbo@google.com>
+Cc: Jerome Glisse <jglisse@redhat.com>
+Cc: Justin Stitt <justinstitt@google.com>
+Cc: Nathan Chancellor <nathan@kernel.org>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/hmm.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/hmm.c
++++ b/mm/hmm.c
+@@ -173,6 +173,7 @@ static inline unsigned long hmm_pfn_flag
+       return order << HMM_PFN_ORDER_SHIFT;
+ }
++#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ static inline unsigned long pmd_to_hmm_pfn_flags(struct hmm_range *range,
+                                                pmd_t pmd)
+ {
+@@ -183,7 +184,6 @@ static inline unsigned long pmd_to_hmm_p
+              hmm_pfn_flags_order(PMD_SHIFT - PAGE_SHIFT);
+ }
+-#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+ static int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr,
+                             unsigned long end, unsigned long hmm_pfns[],
+                             pmd_t pmd)
index 02e8478df5525a26fb91dc5eb339bd7a90201966..08a84bb2f2b486fc4c8c4726626616dd0035607b 100644 (file)
@@ -249,6 +249,10 @@ selftests-perf_events-add-a-mmap-correctness-test.patch
 net-packet-fix-a-race-in-packet_set_ring-and-packet_notifier.patch
 vsock-do-not-allow-binding-to-vmaddr_port_any.patch
 usb-serial-option-add-foxconn-t99w709.patch
-bluetooth-btusb-add-usb-id-3625-010b-for-tp-link-archer-tx10ub-nano.patch
 net-usbnet-avoid-potential-rcu-stall-on-link_change-event.patch
 net-usbnet-fix-the-wrong-netif_carrier_on-call.patch
+alsa-intel_hdmi-fix-off-by-one-error-in-__hdmi_lpe_audio_probe.patch
+kvm-vmx-allow-guest-to-set-debugctl.rtm_debug-if-rtm-is-supported.patch
+mips-mm-tlb-r4k-uniquify-tlb-entries-on-init.patch
+mm-hmm-move-pmd_to_hmm_pfn_flags-to-the-respective-ifdeffery.patch
+usb-gadget-fix-use-after-free-in-composite_dev_cleanup.patch
diff --git a/queue-5.15/usb-gadget-fix-use-after-free-in-composite_dev_cleanup.patch b/queue-5.15/usb-gadget-fix-use-after-free-in-composite_dev_cleanup.patch
new file mode 100644 (file)
index 0000000..b4cdc35
--- /dev/null
@@ -0,0 +1,51 @@
+From 151c0aa896c47a4459e07fee7d4843f44c1bb18e Mon Sep 17 00:00:00 2001
+From: Tao Xue <xuetao09@huawei.com>
+Date: Mon, 21 Jul 2025 17:39:08 +0800
+Subject: usb: gadget : fix use-after-free in composite_dev_cleanup()
+
+From: Tao Xue <xuetao09@huawei.com>
+
+commit 151c0aa896c47a4459e07fee7d4843f44c1bb18e upstream.
+
+1. In func configfs_composite_bind() -> composite_os_desc_req_prepare():
+if kmalloc fails, the pointer cdev->os_desc_req will be freed but not
+set to NULL. Then it will return a failure to the upper-level function.
+2. in func configfs_composite_bind() -> composite_dev_cleanup():
+it will checks whether cdev->os_desc_req is NULL. If it is not NULL, it
+will attempt to use it.This will lead to a use-after-free issue.
+
+BUG: KASAN: use-after-free in composite_dev_cleanup+0xf4/0x2c0
+Read of size 8 at addr 0000004827837a00 by task init/1
+
+CPU: 10 PID: 1 Comm: init Tainted: G           O      5.10.97-oh #1
+ kasan_report+0x188/0x1cc
+ __asan_load8+0xb4/0xbc
+ composite_dev_cleanup+0xf4/0x2c0
+ configfs_composite_bind+0x210/0x7ac
+ udc_bind_to_driver+0xb4/0x1ec
+ usb_gadget_probe_driver+0xec/0x21c
+ gadget_dev_desc_UDC_store+0x264/0x27c
+
+Fixes: 37a3a533429e ("usb: gadget: OS Feature Descriptors support")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Tao Xue <xuetao09@huawei.com>
+Link: https://lore.kernel.org/r/20250721093908.14967-1-xuetao09@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/gadget/composite.c |    5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/drivers/usb/gadget/composite.c
++++ b/drivers/usb/gadget/composite.c
+@@ -2351,6 +2351,11 @@ int composite_os_desc_req_prepare(struct
+       if (!cdev->os_desc_req->buf) {
+               ret = -ENOMEM;
+               usb_ep_free_request(ep0, cdev->os_desc_req);
++              /*
++               * Set os_desc_req to NULL so that composite_dev_cleanup()
++               * will not try to free it again.
++               */
++              cdev->os_desc_req = NULL;
+               goto end;
+       }
+       cdev->os_desc_req->context = cdev;