CVE-2026-64347: usb: gadget: composite: fix dead empty check in the USB_DT_OTG handler

Published Jul 25, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: composite: fix dead empty check in the USBDTOTG handler

The OTG branch of compositesetup() falls back to the first configuration when none is selected:

if (cdev->config) config = cdev->config; else config = listfirstentry(&cdev->configs, struct usbconfiguration, list); if (!config) goto done; ... memcpy(req->buf, config->descriptors[0], value);

listfirstentry() never returns NULL. On an empty list it returns containerof() of the list head. So the "if (!config)" check is dead.

When cdev->configs is empty, config points at the head inside struct usbcompositedev. config->descriptors[0] reads whatever sits at that offset. The memcpy copies up to wlength bytes of it into the response buffer.

cdev->configs can be empty in two cases. One is a teardown race on gadget unbind with a control transfer in flight. The other is a driver that sets isotg before it adds a config. A reproducer that holds cdev->configs empty triggers a KASAN fault in this branch.

Use listfirstentryornull() so the existing check does its job.

Affected Software

10 affected components
Linux Kernel
Linux Linux kernel>=4.3<5.10.261
Linux Linux kernel>=5.11<5.15.212
Linux Linux kernel>=5.16<6.1.178
Linux Linux kernel>=6.2<6.6.145
Linux Linux kernel>=6.7<6.12.96
Linux Linux kernel>=6.13<6.18.39
Linux Linux kernel>=6.19<7.1.4
Linux Linux kernel=7.2-rc1
Linux Linux kernel=7.2-rc2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Linux kernel (usb: gadget: composite: fix dead empty check in the USB_DT_OTG handler) to a version that resolves this vulnerability.

    Patch usb_composite_dev
  2. Configuration

    Apply the fix described: use list_first_entry_or_null() instead of list_first_entry() in the USB_DT_OTG handler so that when cdev->configs is empty the code does not mis-handle container_of(list head) and avoids KASAN faults.

    USB gadget composite (USB_DT_OTG handler) if (!config) check = Remove/replace dead check; use list_first_entry_or_null() to handle empty cdev->configs safely

Event History

Jul 25, 2026
CVE Published
via MITRE·08:50 AM
Data Sourced
via MITRE·08:50 AM
Description
Data Sourced
via NVD·10:17 AM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which systems are exposed to this condition?

Systems using the Linux USB gadget composite framework are exposed when the OTG request handler runs while the gadget has no configurations. The described empty-list state can occur during a gadget unbind teardown race or when a driver sets is_otg before adding a configuration.

2

What is required to trigger the fault?

The OTG branch must process a control transfer while cdev->configs is empty. In that state, the fallback uses list_first_entry(), producing a non-NULL invalid configuration pointer and causing descriptor data to be read and copied from an unintended location.

3

What is the expected impact?

The vulnerability is rated medium with CVSS 5.5 and affects availability only. A reproducer maintaining an empty configuration list triggers a KASAN fault in the affected branch.

4

What does the available fix change?

The fix replaces list_first_entry() with list_first_entry_or_null() in this path. This allows the existing null check to handle an empty configuration list instead of dereferencing the list head as a configuration object.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203