CVE-2025-21838 usb: gadget: core: flush gadget workqueue after device removal

Medium 5.5 Published Updated

A race condition in the Linux kernel USB gadget core allows work to be scheduled after device removal, potentially causing a system crash or denial of service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2025-21838?

CVE-2025-21838 is a medium-severity vulnerability in Linux kernel, published on 7 Mar 2025. It can only be exploited from the same machine or local network, with no action from the victim.

Official description

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

usb: gadget: core: flush gadget workqueue after device removal

device_del() can lead to new work being scheduled in gadget->work workqueue. This is observed, for example, with the dwc3 driver with the following call stack: device_del() gadget_unbind_driver() usb_gadget_disconnect_locked() dwc3_gadget_pullup() dwc3_gadget_soft_disconnect() usb_gadget_set_state() schedule_work(&gadget->work)

Move flush_work() after device_del() to ensure the workqueue is cleaned up.

Which versions are affected by CVE-2025-21838?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2025-21838?

Apply the vendor's patch.

Is CVE-2025-21838 being exploited?

There is no known exploitation of CVE-2025-21838 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-69012, BELL-CVE-2025-21838, DEBIAN-CVE-2025-21838, GHSA-9h49-4vx3-2m5r, ROOT-OS-DEBIAN-11-CVE-2025-21838, ROOT-OS-UBUNTU-2204-CVE-2025-21838 and 2 more.

Is CVE-2025-21838 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free