Search CVEs and advisories

Search CVEs and Linux security advisories by vendor, product, package, or severity, and see which vulnerabilities each advisory addresses.

CVE

CVE-2021-47272

published

usb: dwc3: gadget: Bail from dwc3_gadget_exit() if dwc->gadget is NULL

Published
21 May 2024, 14:20:01 UTC
Updated
11 May 2026, 13:51:17 UTC
Language
en

Package status and fixes

Distro / vendorReleasePackage / productPublisher statusFixed buildSource
Linux — Linuxe81a7018d93a7de31a3f121c9a7eecd0a5ec58b0 to < 851dee5a5da56564a70290713aee665403bb0b24 · e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0 to < 4aad390363d2b9b3e92428dd34d27bb7ea8f1ee8 · e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0 to < 03715ea2e3dbbc56947137ce3b4ac18a726b2f87 · Other versions: unaffected Affected Not stated Linux
Linux — Linux5.10 (affected) · 0 to < 5.10 (unaffected · semver) · 5.10.44 through 5.10.* (unaffected · semver) · 5.12.11 through 5.12.* (unaffected · semver) · 5.13 and later (unaffected · original_commit_for_fix) · Other versions: affected Version-specific Not stated Linux
Amazon Linux AL2 Release evaluation Not Affected Not required Amazon Linux assessment
Amazon Linux AL2023 Release evaluation Not Affected Not required Amazon Linux assessment

Description

In the Linux kernel, the following vulnerability has been resolved: usb: dwc3: gadget: Bail from dwc3_gadget_exit() if dwc->gadget is NULL There exists a possible scenario in which dwc3_gadget_init() can fail: during during host -> peripheral mode switch in dwc3_set_mode(), and a pending gadget driver fails to bind. Then, if the DRD undergoes another mode switch from peripheral->host the resulting dwc3_gadget_exit() will attempt to reference an invalid and dangling dwc->gadget pointer as well as call dma_free_coherent() on unmapped DMA pointers. The exact scenario can be reproduced as follows: - Start DWC3 in peripheral mode - Configure ConfigFS gadget with FunctionFS instance (or use g_ffs) - Run FunctionFS userspace application (open EPs, write descriptors, etc) - Bind gadget driver to DWC3's UDC - Switch DWC3 to host mode => dwc3_gadget_exit() is called. usb_del_gadget() will put the ConfigFS driver instance on the gadget_driver_pending_list - Stop FunctionFS application (closes the ep files) - Switch DWC3 to peripheral mode => dwc3_gadget_init() fails as usb_add_gadget() calls check_pending_gadget_drivers() and attempts to rebind the UDC to the ConfigFS gadget but fails with -19 (-ENODEV) because the FFS instance is not in FFS_ACTIVE state (userspace has not re-opened and written the descriptors yet, i.e. desc_ready!=0). - Switch DWC3 back to host mode => dwc3_gadget_exit() is called again, but this time dwc->gadget is invalid. Although it can be argued that userspace should take responsibility for ensuring that the FunctionFS application be ready prior to allowing the composite driver bind to the UDC, failure to do so should not result in a panic from the kernel driver. Fix this by setting dwc->gadget to NULL in the failure path of dwc3_gadget_init() and add a check to dwc3_gadget_exit() to bail out unless the gadget pointer is valid.

en · Linux · cna

Vendor advisories explicitly linked to this CVE.

0

No linked advisories were found for this CVE.

Assessment

CVSS risk assessment and additional context for this vulnerability.

No normalized assessments.

Publisher product statements

Version ranges and default statuses as reported by each provider.

Affected vendor and product assertions
VendorProductVersion statusSource
Linux Linux e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0 to < 851dee5a5da56564a70290713aee665403bb0b24 (affected · git)e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0 to < 4aad390363d2b9b3e92428dd34d27bb7ea8f1ee8 (affected · git)e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0 to < 03715ea2e3dbbc56947137ce3b4ac18a726b2f87 (affected · git)Default: unaffected Linux · cna
Linux Linux 5.10 (affected)0 to < 5.10 (unaffected · semver)5.10.44 through 5.10.* (unaffected · semver)5.12.11 through 5.12.* (unaffected · semver)5.13 and later (unaffected · original_commit_for_fix)Default: affected Linux · cna

Weaknesses

0

No weakness assertions.

References

3

Provider assertions

3

Linux · cna

usb: dwc3: gadget: Bail from dwc3_gadget_exit() if dwc->gadget is NULL

CISA-ADP · adp

CISA ADP Vulnrichment

CVE · adp

CVE Program Container

Provenance

Schema
5.2
Searchable
yes
Content hash
6dc97725a497e6df27f6cbfa2b5bceea8ebabd958d09bd2e2dd5c6b14d50da34
Ingested
23 Sep 2026, 07:57:11 UTC
Source record
Official CVE record

Search filters

Match options apply to free text. CVE words match tokens; use contains:"…" for literal substrings.

Text

Words and phrases
buffer overflow "remote code execution"
Word prefix
auth*
Literal substring (title or description)
contains:"use-after-free"
Exclude a term or filter
-test -vendor:example

Affected product

Vendor
vendor:Example
Product
product:"Demo Widget"

Severity and score

Severity · none, low, medium, high, critical, unknown
severity:critical
CWE identifier
cwe:CWE-863
CVSS score (0–10)
cvss:>=7.0

Dates and status

Published date · comparisons, relative days
published:>=2026-01-01
Updated date · comparisons, relative days
updated:<30d
Status · published (default), rejected, unknown
status:rejected