CVE-2026-31721: usb: gadget: f_hid: move list and spinlock inits from bind to alloc

Published May 1, 2026
·
Updated

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

usb: gadget: fhid: move list and spinlock inits from bind to alloc

There was an issue when you did the following: - setup and bind an hid gadget - open /dev/hidg0 - use the resulting fd in EPOLLCTLADD - unbind the UDC - bind the UDC - use the fd in EPOLLCTLDEL

When CONFIGDEBUGLIST was enabled, a listdel corruption was reported within removewaitqueue (via epremovewaitqueue). After some debugging I found out that the queues, which fhid registers via pollwait were the problem. These were initialized using initwaitqueuehead inside hidgbind. So effectively, the bind function re-initialized the queues while there were still items in them.

The solution is to move the initialization from hidgbind to hidgalloc to extend their lifetimes to the lifetime of the function instance.

Additionally, I found many other possibly problematic init calls in the bind function, which I moved as well.

Affected Software

16 affected componentsFixes available
Linux Linux kernel (usb gadget f_hid)
Microsoft azl3 kernel 6.6.134.1-2
Linux Linux kernel>=3.19<5.10.253
Linux Linux kernel>=5.11<5.15.203
Linux Linux kernel>=5.16<6.1.169
Linux Linux kernel>=6.2<6.6.135
Linux Linux kernel>=6.7<6.12.81
Linux Linux kernel>=6.13<6.18.22
Linux Linux kernel>=6.19<6.19.12
Linux Linux kernel=7.0-rc1
Linux Linux kernel=7.0-rc2
Linux Linux kernel=7.0-rc3
Linux Linux kernel=7.0-rc4
Linux Linux kernel=7.0-rc5
Linux Linux kernel=7.0-rc6
debian/linux
6.1.176-16.1.190-16.12.107-16.12.115-27.2.12-17.2.15-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/linux to a version that resolves this vulnerability.

    Fixed in 6.1.176-1Fixed in 6.1.190-1Fixed in 6.12.107-1Fixed in 6.12.113-1Fixed in 7.2.12-1Fixed in 7.2.13-1
  2. Configuration

    Move the list, spinlock, and waitqueue initializations from hidg_bind to hidg_alloc so their lifetimes extend to the lifetime of the function instance.

    Linux kernel USB gadget f_hid list, spinlock, and waitqueue initialization location = hidg_alloc

Event History

May 1, 2026
CVE Published
via MITRE·02:14 PM
Data Sourced
via MITRE·02:14 PM
Description
Data Sourced
via NVD·03:16 PM
RemedyDescriptionSeverityAffected Software
May 2, 2026
Data Sourced
via Microsoft·08:03 AM
DescriptionSeverityWeaknessAffected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

What is the severity of CVE-2026-31721?

The severity of CVE-2026-31721 is classified as high due to potential data exposure via improperly initialized structures.

2

How do I fix CVE-2026-31721?

To address CVE-2026-31721, ensure you update your Linux kernel to the latest version that resolves this vulnerability.

3

What versions of the Linux kernel are affected by CVE-2026-31721?

CVE-2026-31721 affects Linux kernels from version 3.19 up to but not including 7.0-rc1.

4

Can CVE-2026-31721 be exploited remotely?

Yes, CVE-2026-31721 can be exploited remotely if the vulnerable USB gadget is bound and accessible.

5

What components are specifically impacted by CVE-2026-31721?

CVE-2026-31721 specifically impacts the USB gadget framework, particularly the f_hid component.

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