CVE-2022-49398
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
26/02/2025
Last modified:
21/10/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
usb: dwc3: gadget: Replace list_for_each_entry_safe() if using giveback<br />
<br />
The list_for_each_entry_safe() macro saves the current item (n) and<br />
the item after (n+1), so that n can be safely removed without<br />
corrupting the list. However, when traversing the list and removing<br />
items using gadget giveback, the DWC3 lock is briefly released,<br />
allowing other routines to execute. There is a situation where, while<br />
items are being removed from the cancelled_list using<br />
dwc3_gadget_ep_cleanup_cancelled_requests(), the pullup disable<br />
routine is running in parallel (due to UDC unbind). As the cleanup<br />
routine removes n, and the pullup disable removes n+1, once the<br />
cleanup retakes the DWC3 lock, it references a request who was already<br />
removed/handled. With list debug enabled, this leads to a panic.<br />
Ensure all instances of the macro are replaced where gadget giveback<br />
is used.<br />
<br />
Example call stack:<br />
<br />
Thread#1:<br />
__dwc3_gadget_ep_set_halt() - CLEAR HALT<br />
-> dwc3_gadget_ep_cleanup_cancelled_requests()<br />
->list_for_each_entry_safe()<br />
->dwc3_gadget_giveback(n)<br />
->dwc3_gadget_del_and_unmap_request()- n deleted[cancelled_list]<br />
->spin_unlock<br />
->Thread#2 executes<br />
...<br />
->dwc3_gadget_giveback(n+1)<br />
->Already removed!<br />
<br />
Thread#2:<br />
dwc3_gadget_pullup()<br />
->waiting for dwc3 spin_lock<br />
...<br />
->Thread#1 released lock<br />
->dwc3_stop_active_transfers()<br />
->dwc3_remove_requests()<br />
->fetches n+1 item from cancelled_list (n removed by Thread#1)<br />
->dwc3_gadget_giveback()<br />
->dwc3_gadget_del_and_unmap_request()- n+1 deleted[cancelled_list]<br />
->spin_unlock
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.19.57 (including) | 4.20 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.0 (including) | 5.15.47 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.17.15 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.18 (including) | 5.18.4 (excluding) |
To consult the complete list of CPE names with products and versions, see this page



