# CVE-2022-49943: USB: gadget: Fix obscure lockdep violation for udc\_mutex

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 5.5
- **CVSS:** 5.5 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 4, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2025-06-18T10:59:58.516Z
- **Modified:** 2026-06-17T05:19:35.257Z

## Who should check

- Anyone running Linux \>= f44b0b95d50fffeca036e1ba36770390e0b519dd, \< 1a065e4673cbdd9f222a05f85e17d78ea50c8d9c; \>= 2191c00855b03aa59c20e698be713d952d51fc18, \< 1016fc0c096c92dd0e6e0541daac7a7868169903
- Anyone running Linux \>= 5.19.7, \< 5.19.8

## Description

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

USB: gadget: Fix obscure lockdep violation for udc\_mutex

A recent commit expanding the scope of the udc\_lock mutex in the
gadget core managed to cause an obscure and slightly bizarre lockdep
violation.  In abbreviated form:

======================================================
WARNING: possible circular locking dependency detected
5.19.0-rc7+ \#12510 Not tainted
------------------------------------------------------
udevadm/312 is trying to acquire lock:
ffff80000aae1058 (udc\_lock){+.+.}-{3:3}, at: usb\_udc\_uevent+0x54/0xe0

but task is already holding lock:
ffff000002277548 (kn-\>active\#4){++++}-{0:0}, at: kernfs\_seq\_start+0x34/0xe0

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-\> \#3 (kn-\>active\#4){++++}-{0:0}:
        lock\_acquire+0x68/0x84
        \_\_kernfs\_remove+0x268/0x380
        kernfs\_remove\_by\_name\_ns+0x58/0xac
        sysfs\_remove\_file\_ns+0x18/0x24
        device\_del+0x15c/0x440

-\> \#2 (device\_links\_lock){+.+.}-{3:3}:
        lock\_acquire+0x68/0x84
        \_\_mutex\_lock+0x9c/0x430
        mutex\_lock\_nested+0x38/0x64
        device\_link\_remove+0x3c/0xa0
        \_regulator\_put.part.0+0x168/0x190
        regulator\_put+0x3c/0x54
        devm\_regulator\_release+0x14/0x20

-\> \#1 (regulator\_list\_mutex){+.+.}-{3:3}:
        lock\_acquire+0x68/0x84
        \_\_mutex\_lock+0x9c/0x430
        mutex\_lock\_nested+0x38/0x64
        regulator\_lock\_dependent+0x54/0x284
        regulator\_enable+0x34/0x80
        phy\_power\_on+0x24/0x130
        \_\_dwc2\_lowlevel\_hw\_enable+0x100/0x130
        dwc2\_lowlevel\_hw\_enable+0x18/0x40
        dwc2\_hsotg\_udc\_start+0x6c/0x2f0
        gadget\_bind\_driver+0x124/0x1f4

-\> \#0 (udc\_lock){+.+.}-{3:3}:
        \_\_lock\_acquire+0x1298/0x20cc
        lock\_acquire.part.0+0xe0/0x230
        lock\_acquire+0x68/0x84
        \_\_mutex\_lock+0x9c/0x430
        mutex\_lock\_nested+0x38/0x64
        usb\_udc\_uevent+0x54/0xe0

Evidently this was caused by the scope of udc\_mutex being too large.
The mutex is only meant to protect udc-\>driver along with a few other
things.  As far as I can tell, there's no reason for the mutex to be
held while the gadget core calls a gadget driver's -\>bind or -\>unbind
routine, or while a UDC is being started or stopped.  (This accounts
for link \#1 in the chain above, where the mutex is held while the
dwc2\_hsotg\_udc is started as part of driver probing.)

Gadget drivers' -\>disconnect callbacks are problematic.  Even though
usb\_gadget\_disconnect() will now acquire the udc\_mutex, there's a
window in usb\_gadget\_bind\_driver() between the times when the mutex is
released and the -\>bind callback is invoked.  If a disconnect occurred
during that window, we could call the driver's -\>disconnect routine
before its -\>bind routine.  To prevent this from happening, it will be
necessary to prevent a UDC from connecting while it has no gadget
driver.  This should be done already but it doesn't seem to be;
currently usb\_gadget\_connect() has no check for this.  Such a check
will have to be added later.

Some degree of mutual exclusion is required in soft\_connect\_store(),
which can dereference udc-\>driver at arbitrary times since it is a
sysfs callback.  The solution here is to acquire the gadget's device
lock rather than the udc\_mutex.  Since the driver core guarantees that
the device lock is always held during driver binding and unbinding,
this will make the accesses in soft\_connect\_store() mutually exclusive
with any changes to udc-\>driver.

Lastly, it turns out there is one place which should hold the
udc\_mutex but currently does not: The function\_show() routine needs
protection while it dereferences udc-\>driver.  The missing lock and
unlock calls are added.

## Affected and fixed versions

- Linux: \>= f44b0b95d50fffeca036e1ba36770390e0b519dd, \< 1a065e4673cbdd9f222a05f85e17d78ea50c8d9c; \>= 2191c00855b03aa59c20e698be713d952d51fc18, \< 1016fc0c096c92dd0e6e0541daac7a7868169903 (cvelist)
- Linux: \>= 5.19.7, \< 5.19.8 (cvelist)

## Mitigation

- Upgrade Linux to 1016fc0c096c92dd0e6e0541daac7a7868169903 or later.
- Upgrade Linux to 5.19.8 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2022-49943. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2022-49943.md
Affected: Linux >= f44b0b95d50fffeca036e1ba36770390e0b519dd, < 1a065e4673cbdd9f222a05f85e17d78ea50c8d9c; >= 2191c00855b03aa59c20e698be713d952d51fc18, < 1016fc0c096c92dd0e6e0541daac7a7868169903; Linux >= 5.19.7, < 5.19.8
Fixed in: Linux 1a065e4673cbdd9f222a05f85e17d78ea50c8d9c, Linux 1016fc0c096c92dd0e6e0541daac7a7868169903, Linux 5.19.8

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.
```

## FAQ

### Is CVE-2022-49943 being exploited?

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

### How serious is CVE-2022-49943?

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

### Which versions are affected by CVE-2022-49943?

Linux \>= f44b0b95d50fffeca036e1ba36770390e0b519dd, \< 1a065e4673cbdd9f222a05f85e17d78ea50c8d9c; \>= 2191c00855b03aa59c20e698be713d952d51fc18, \< 1016fc0c096c92dd0e6e0541daac7a7868169903; Linux \>= 5.19.7, \< 5.19.8.

### Is there a fix for CVE-2022-49943?

Yes. Fixed in Linux 1a065e4673cbdd9f222a05f85e17d78ea50c8d9c, Linux 1016fc0c096c92dd0e6e0541daac7a7868169903, Linux 5.19.8. Upgrade Linux to 1016fc0c096c92dd0e6e0541daac7a7868169903 or later. Upgrade Linux to 5.19.8 or later.

### How do I check if I'm affected by CVE-2022-49943?

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.

## References

- patch: <https://git.kernel.org/stable/c/1a065e4673cbdd9f222a05f85e17d78ea50c8d9c>
- patch: <https://git.kernel.org/stable/c/1016fc0c096c92dd0e6e0541daac7a7868169903>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2022-49943>

HTML: <https://flawdb.com/CVE-2022-49943> · JSON: <https://flawdb.com/api/v1/entries/CVE-2022-49943>
