Skip to content
FlawDB
Sign in
Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

CVE-2021-46986

MEDIUM 5.5EPSS 8%

usb: dwc3: gadget: Free gadget structure only after freeing endpoints

Mitigation

  • No fix listed yet: follow the vendor advisory.

Who should check

  • Anyone running Linux >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < 1ea775021282d90e1d08d696b7ab54aa75d688e5; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bc0cdd72493236fb72b390ad38ce581e353c143c; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < b4b8e9601d7ee8806d2687f081a42485d27674a1; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bb9c74a5bd1462499fe5ccb1e3c5ac40dcfa9139
  • Anyone running Linux 5.10

Vulnerability facts

Affected
Linux >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < 1ea775021282d90e1d08d696b7ab54aa75d688e5; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bc0cdd72493236fb72b390ad38ce581e353c143c; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < b4b8e9601d7ee8806d2687f081a42485d27674a1; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bb9c74a5bd1462499fe5ccb1e3c5ac40dcfa9139; Linux 5.10
Fixed in
Linux 1ea775021282d90e1d08d696b7ab54aa75d688e5
Exploited in the wild
Not in CISA KEV
Public exploit / PoC
None known
Remote exploitation
Not remotely exploitable (local or adjacent access needed)
CVSS
5.5 (v3.1, NVD)CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
  • Attack vector: Local
  • Attack complexity: Low
  • Privileges required: Low
  • User interaction: None
  • Scope: Unchanged
  • Confidentiality impact: None
  • Integrity impact: None
  • Availability impact: High
EPSS
0.23% chance of exploitation in 30 days (percentile 8, 2026-11-26)
CWE
CWE-416
Published
Modified

Description

In the Linux kernel, the following vulnerability has been resolved: usb: dwc3: gadget: Free gadget structure only after freeing endpoints As part of commit e81a7018d93a ("usb: dwc3: allocate gadget structure dynamically") the dwc3_gadget_release() was added which will free the dwc->gadget structure upon the device's removal when usb_del_gadget_udc() is called in dwc3_gadget_exit(). However, simply freeing the gadget results a dangling pointer situation: the endpoints created in dwc3_gadget_init_endpoints() have their dep->endpoint.ep_list members chained off the list_head anchored at dwc->gadget->ep_list. Thus when dwc->gadget is freed, the first dwc3_ep in the list now has a dangling prev pointer and likewise for the next pointer of the dwc3_ep at the tail of the list. The dwc3_gadget_free_endpoints() that follows will result in a use-after-free when it calls list_del(). This was caught by enabling KASAN and performing a driver unbind. The recent commit 568262bf5492 ("usb: dwc3: core: Add shutdown callback for dwc3") also exposes this as a panic during shutdown. There are a few possibilities to fix this. One could be to perform a list_del() of the gadget->ep_list itself which removes it from the rest of the dwc3_ep chain. Another approach is what this patch does, by splitting up the usb_del_gadget_udc() call into its separate "del" and "put" components. This allows dwc3_gadget_free_endpoints() to be called before the gadget is finally freed with usb_put_gadget().

Affected and fixed versions

Package / productAffectedFixedSource
Linux>= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < 1ea775021282d90e1d08d696b7ab54aa75d688e5; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bc0cdd72493236fb72b390ad38ce581e353c143c; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < b4b8e9601d7ee8806d2687f081a42485d27674a1; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bb9c74a5bd1462499fe5ccb1e3c5ac40dcfa9139—cvelist
Linux5.10—cvelist

Check your systems with an agent

Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.

Check whether anything I run is affected by CVE-2021-46986. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2021-46986.md
Affected: Linux >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < 1ea775021282d90e1d08d696b7ab54aa75d688e5; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bc0cdd72493236fb72b390ad38ce581e353c143c; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < b4b8e9601d7ee8806d2687f081a42485d27674a1; >= e81a7018d93a7de31a3f121…
Fixed in: Linux 1ea775021282d90e1d08d696b7ab54aa75d688e5

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.

References

FAQ

Is CVE-2021-46986 being exploited?

There is no confirmed exploitation: CVE-2021-46986 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.23% chance of exploitation in the next 30 days (as of 2026-11-26).

How serious is CVE-2021-46986?

Medium: CVSS 5.5 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

Which versions are affected by CVE-2021-46986?

Linux >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < 1ea775021282d90e1d08d696b7ab54aa75d688e5; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bc0cdd72493236fb72b390ad38ce581e353c143c; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < b4b8e9601d7ee8806d2687f081a42485d27674a1; >= e81a7018d93a7de31a3f121c9a7eecd0a5ec58b0, < bb9c74a5bd1462499fe5ccb1e3c5ac40dcfa9139; Linux 5.10.

Is there a fix for CVE-2021-46986?

Yes. Fixed in Linux 1ea775021282d90e1d08d696b7ab54aa75d688e5. No fix listed yet: follow the vendor advisory.

How do I check if I'm affected by CVE-2021-46986?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

Sponsors