CVE-2022-49398: usb: dwc3: gadget: Replace list_for_each_entry_safe() if using giveback
In the Linux kernel, the following vulnerability has been resolved:
usb: dwc3: gadget: Replace list_for_each_entry_safe() if using giveback
The list_for_each_entry_safe() macro saves the current item (n) and
the item after (n+1), so that n can be safely removed without
corrupting the list. However, when traversing the list and removing
items using gadget giveback, the DWC3 lock is briefly released,
allowing other routines to execute. There is a situation where, while
items are being removed from the cancelled_list using
dwc3_gadget_ep_cleanup_cancelled_requests(), the pullup disable
routine is running in parallel (due to UDC unbind). As the cleanup
routine removes n, and the pullup disable removes n+1, once the
cleanup retakes the DWC3 lock, it references a request who was already
removed/handled. With list debug enabled, this leads to a panic.
Ensure all instances of the macro are replaced where gadget giveback
is used.
Example call stack:
Thread#1:
__dwc3_gadget_ep_set_halt() - CLEAR HALT
-> dwc3_gadget_ep_cleanup_cancelled_requests()
->list_for_each_entry_safe()
->dwc3_gadget_giveback(n)
->dwc3_gadget_del_and_unmap_request()- n deleted[cancelled_list]
->spin_unlock
->Thread#2 executes
...
->dwc3_gadget_giveback(n+1)
->Already removed!
Thread#2:
dwc3_gadget_pullup()
->waiting for dwc3 spin_lock
...
->Thread#1 released lock
->dwc3_stop_active_transfers()
->dwc3_remove_requests()
->fetches n+1 item from cancelled_list (n removed by Thread#1)
->dwc3_gadget_giveback()
->dwc3_gadget_del_and_unmap_request()- n+1 deleted[cancelled_list]
->spin_unlock
Security readout for executives and security teams
Plain-English summary
This is a Linux kernel race condition in the DWC3 USB gadget driver. Under specific parallel cleanup and USB disconnect/unbind activity, the kernel may reference a request already handled, causing a panic when list debugging is enabled. The public bundle does not provide a CVSS score or evidence of active exploitation.
Executive priority
Prioritize remediation for embedded, appliance, mobile, or specialized Linux systems that use USB gadget mode. For standard servers without this functionality, treat as lower urgency but still track through normal kernel patching. Absence of CVSS and exploitation evidence limits confidence in business impact.
Technical view
The bug involves list traversal during DWC3 gadget giveback. The lock can be briefly released, allowing another routine to remove the next request from cancelled_list. When cleanup resumes, it may operate on an already removed request. Stable kernel commits replace unsafe list_for_each_entry_safe() usage where giveback occurs.
Likely exposure
Exposure is most relevant to Linux systems running affected kernel versions with DWC3 USB gadget functionality in use. General-purpose systems without DWC3 gadget mode are less likely to be exposed. The source bundle lists Linux as affected but does not identify downstream distributions or specific devices.
Exploitation context
The bundle marks KEV as false and gives no cited evidence of active exploitation. The described condition is a concurrency race around USB gadget request cleanup and pullup disable during UDC unbind. Public evidence supports a kernel stability issue, not confirmed real-world exploitation.
Researcher notes
Evidence is limited to the CVE description and Linux stable references. Key validation points are affected kernel lineage, whether DWC3 gadget code is built and used, and whether downstream vendors backported the fix. Do not assume exploitability beyond the documented panic scenario.
Mitigation direction
Inventory affected Linux kernels and DWC3 USB gadget usage.
Apply vendor kernel updates containing the referenced stable fixes.
Check distribution advisories for backported fixes if versions differ.
Disable unused USB gadget functionality where operationally feasible.
Plan required reboot or maintenance for kernel replacement.
Validation and detection
Confirm the running kernel includes a fixed commit or vendor backport.
Review kernel configuration and hardware use for DWC3 gadget mode.
Check kernel logs for DWC3 gadget list corruption or panic indicators.
Verify patch status against vendor advisories and kernel changelogs.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2022-49398 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
0CVSS vectors
3Timeline events
0ADP providers
5Source links
Vulnerability timeline
Timeline events are normalized from CVE metadata, CNA source timelines, ADP timelines, and KEV metadata when present.
CVE reservedCVE Program
The CVE ID was reserved by the assigning CNA.
CVE publishedCVE Program
The CVE record was published.
Feb 26, 2025, 02:12 UTC (UTC+00:00)
CVE updatedCVE Program
The CVE record metadata indicates this as the latest update time.