# CVE-2025-38373: IB/mlx5: Fix potential deadlock in MR deregistration

> 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.19% (percentile 5, 2026-11-26)
- **CWE:** CWE-667
- **Published:** 2025-07-25T12:53:16.082Z
- **Modified:** 2026-10-30T13:18:03.610Z

## Who should check

- Anyone running Linux \>= b13d32786acabf70a7b04ed24b7468fc3c82977c, \< beb89ada5715e7bd1518c58863eedce89ec051a7; \>= abb604a1a9c87255c7a6f3b784410a9707baf467, \< 727eb1be65a370572edf307558ec3396b8573156; \>= abb604a1a9c87255c7a6f3b784410a9707baf467, \< 2ed25aa7f7711f508b6120e336f05cd9d49943c0; 63126215de7beebb662fcef7c7558c795000c904; 5297f5ddffef47b94172ab0d3d62270002a3dcc1; \>= 6.12.14, \< 6.12.37; \>= 6.1.191, \< 6.2; \>= 6.13.3, \< 6.14
- Anyone running Linux 6.14

## Description

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

IB/mlx5: Fix potential deadlock in MR deregistration

The issue arises when kzalloc() is invoked while holding umem\_mutex or
any other lock acquired under umem\_mutex. This is problematic because
kzalloc() can trigger fs\_reclaim\_aqcuire(), which may, in turn, invoke
mmu\_notifier\_invalidate\_range\_start(). This function can lead to
mlx5\_ib\_invalidate\_range(), which attempts to acquire umem\_mutex again,
resulting in a deadlock.

The problematic flow:
             CPU0                      \|              CPU1
---------------------------------------\|------------------------------------------------
mlx5\_ib\_dereg\_mr()                     \|
 → revoke\_mr()                         \|
   → mutex\_lock(&umem\_odp-\>umem\_mutex) \|
                                       \| mlx5\_mkey\_cache\_init()
                                       \|  → mutex\_lock(&dev-\>cache.rb\_lock)
                                       \|  → mlx5r\_cache\_create\_ent\_locked()
                                       \|    → kzalloc(GFP\_KERNEL)
                                       \|      → fs\_reclaim()
                                       \|        → mmu\_notifier\_invalidate\_range\_start()
                                       \|          → mlx5\_ib\_invalidate\_range()
                                       \|            → mutex\_lock(&umem\_odp-\>umem\_mutex)
   → cache\_ent\_find\_and\_store()        \|
     → mutex\_lock(&dev-\>cache.rb\_lock) \|

Additionally, when kzalloc() is called from within
cache\_ent\_find\_and\_store(), we encounter the same deadlock due to
re-acquisition of umem\_mutex.

Solve by releasing umem\_mutex in dereg\_mr() after umr\_revoke\_mr()
and before acquiring rb\_lock. This ensures that we don't hold
umem\_mutex while performing memory allocations that could trigger
the reclaim path.

This change prevents the deadlock by ensuring proper lock ordering and
avoiding holding locks during memory allocation operations that could
trigger the reclaim path.

The following lockdep warning demonstrates the deadlock:

 python3/20557 is trying to acquire lock:
 ffff888387542128 (&umem\_odp-\>umem\_mutex){+.+.}-{4:4}, at:
 mlx5\_ib\_invalidate\_range+0x5b/0x550 \[mlx5\_ib\]

 but task is already holding lock:
 ffffffff82f6b840 (mmu\_notifier\_invalidate\_range\_start){+.+.}-{0:0}, at:
 unmap\_vmas+0x7b/0x1a0

 which lock already depends on the new lock.

 the existing dependency chain (in reverse order) is:

 -\> \#3 (mmu\_notifier\_invalidate\_range\_start){+.+.}-{0:0}:
       fs\_reclaim\_acquire+0x60/0xd0
       mem\_cgroup\_css\_alloc+0x6f/0x9b0
       cgroup\_init\_subsys+0xa4/0x240
       cgroup\_init+0x1c8/0x510
       start\_kernel+0x747/0x760
       x86\_64\_start\_reservations+0x25/0x30
       x86\_64\_start\_kernel+0x73/0x80
       common\_startup\_64+0x129/0x138

 -\> \#2 (fs\_reclaim){+.+.}-{0:0}:
       fs\_reclaim\_acquire+0x91/0xd0
       \_\_kmalloc\_cache\_noprof+0x4d/0x4c0
       mlx5r\_cache\_create\_ent\_locked+0x75/0x620 \[mlx5\_ib\]
       mlx5\_mkey\_cache\_init+0x186/0x360 \[mlx5\_ib\]
       mlx5\_ib\_stage\_post\_ib\_reg\_umr\_init+0x3c/0x60 \[mlx5\_ib\]
       \_\_mlx5\_ib\_add+0x4b/0x190 \[mlx5\_ib\]
       mlx5r\_probe+0xd9/0x320 \[mlx5\_ib\]
       auxiliary\_bus\_probe+0x42/0x70
       really\_probe+0xdb/0x360
       \_\_driver\_probe\_device+0x8f/0x130
       driver\_probe\_device+0x1f/0xb0
       \_\_driver\_attach+0xd4/0x1f0
       bus\_for\_each\_dev+0x79/0xd0
       bus\_add\_driver+0xf0/0x200
       driver\_register+0x6e/0xc0
       \_\_auxiliary\_driver\_register+0x6a/0xc0
       do\_one\_initcall+0x5e/0x390
       do\_init\_module+0x88/0x240
       init\_module\_from\_file+0x85/0xc0
       idempotent\_init\_module+0x104/0x300
       \_\_x64\_sys\_finit\_module+0x68/0xc0
       do\_syscall\_64+0x6d/0x140
       entry\_SYSCALL\_64\_after\_hwframe+0x4b/0x53

 -\> \#1 (&dev-\>cache.rb\_lock){+.+.}-{4:4}:
       \_\_mutex\_lock+0x98/0xf10
       \_\_mlx5\_ib\_dereg\_mr+0x6f2/0x890 \[mlx5\_ib\]
       mlx5\_ib\_dereg\_mr+0x21/0x110 \[mlx5\_ib\]
       ib\_dereg\_mr\_user+0x85/0x1f0 \[ib\_core\]
  
---truncated---

## Affected and fixed versions

- Linux: \>= b13d32786acabf70a7b04ed24b7468fc3c82977c, \< beb89ada5715e7bd1518c58863eedce89ec051a7; \>= abb604a1a9c87255c7a6f3b784410a9707baf467, \< 727eb1be65a370572edf307558ec3396b8573156; \>= abb604a1a9c87255c7a6f3b784410a9707baf467, \< 2ed25aa7f7711f508b6120e336f05cd9d49943c0; 63126215de7beebb662fcef7c7558c795000c904; 5297f5ddffef47b94172ab0d3d62270002a3dcc1; \>= 6.12.14, \< 6.12.37; \>= 6.1.191, \< 6.2; \>= 6.13.3, \< 6.14 (cvelist)
- Linux: 6.14 (cvelist)

## Mitigation

- Upgrade Linux to 6.14 or later.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2025-38373.md
Affected: Linux >= b13d32786acabf70a7b04ed24b7468fc3c82977c, < beb89ada5715e7bd1518c58863eedce89ec051a7; >= abb604a1a9c87255c7a6f3b784410a9707baf467, < 727eb1be65a370572edf307558ec3396b8573156; >= abb604a1a9c87255c7a6f3b784410a9707baf467, < 2ed25aa7f7711f508b6120e336f05cd9d49943c0; 63126215de7beebb662fcef7c7…
Fixed in: Linux 727eb1be65a370572edf307558ec3396b8573156, Linux 2ed25aa7f7711f508b6120e336f05cd9d49943c0, Linux 6.12.37, Linux 6.2, Linux 6.14

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-2025-38373 being exploited?

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

### How serious is CVE-2025-38373?

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

### Which versions are affected by CVE-2025-38373?

Linux \>= b13d32786acabf70a7b04ed24b7468fc3c82977c, \< beb89ada5715e7bd1518c58863eedce89ec051a7; \>= abb604a1a9c87255c7a6f3b784410a9707baf467, \< 727eb1be65a370572edf307558ec3396b8573156; \>= abb604a1a9c87255c7a6f3b784410a9707baf467, \< 2ed25aa7f7711f508b6120e336f05cd9d49943c0; 63126215de7beebb662fcef7c7558c795000c904; 5297f5ddffef47b94172ab0d3d62270002a3dcc1; \>= 6.12.14, \< 6.12.37; \>= 6.1.191, \< 6.2; \>= 6.13.3, \< 6.14; Linux 6.14.

### Is there a fix for CVE-2025-38373?

Yes. Fixed in Linux 727eb1be65a370572edf307558ec3396b8573156, Linux 2ed25aa7f7711f508b6120e336f05cd9d49943c0, Linux 6.12.37, Linux 6.2, Linux 6.14. Upgrade Linux to 6.14 or later.

### How do I check if I'm affected by CVE-2025-38373?

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/beb89ada5715e7bd1518c58863eedce89ec051a7>
- patch: <https://git.kernel.org/stable/c/727eb1be65a370572edf307558ec3396b8573156>
- patch: <https://git.kernel.org/stable/c/2ed25aa7f7711f508b6120e336f05cd9d49943c0>

## 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-2025-38373>

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