# CVE-2025-38161: RDMA/mlx5: Fix error flow upon firmware failure for RQ destruction

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

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; 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.30% (percentile 15, 2026-11-26)
- **CWE:** CWE-191
- **Published:** 2025-07-03T08:36:03.087Z
- **Modified:** 2026-10-15T22:18:29.370Z

## Who should check

- Anyone running Linux \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 26d2f662d3a6655a82fd8a287e8b1ce471567f36; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< f9784da76ad7be66230e829e743bdf68a2c49e56; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< cf32affe6f3801cfb72a65e69c4bc7a8ee9be100; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 7c4c84cdcc19e89d42f6bf117238e5471173423e; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 50ac361ff8914133e3cf6ef184bac90c22cb8d79; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 0a7790cbba654e925243571cf2f24d61603d3ed3; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6
- Anyone running Linux 4.5

## Description

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

RDMA/mlx5: Fix error flow upon firmware failure for RQ destruction

Upon RQ destruction if the firmware command fails which is the
last resource to be destroyed some SW resources were already cleaned
regardless of the failure.

Now properly rollback the object to its original state upon such failure.

In order to avoid a use-after free in case someone tries to destroy the
object again, which results in the following kernel trace:
refcount\_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 37589 at lib/refcount.c:28 refcount\_warn\_saturate+0xf4/0x148
Modules linked in: rdma\_ucm(OE) rdma\_cm(OE) iw\_cm(OE) ib\_ipoib(OE) ib\_cm(OE) ib\_umad(OE) mlx5\_ib(OE) rfkill mlx5\_core(OE) mlxdevm(OE) ib\_uverbs(OE) ib\_core(OE) psample mlxfw(OE) mlx\_compat(OE) macsec tls pci\_hyperv\_intf sunrpc vfat fat virtio\_net net\_failover failover fuse loop nfnetlink vsock\_loopback vmw\_vsock\_virtio\_transport\_common vmw\_vsock\_vmci\_transport vmw\_vmci vsock xfs crct10dif\_ce ghash\_ce sha2\_ce sha256\_arm64 sha1\_ce virtio\_console virtio\_gpu virtio\_blk virtio\_dma\_buf virtio\_mmio dm\_mirror dm\_region\_hash dm\_log dm\_mod xpmem(OE)
CPU: 0 UID: 0 PID: 37589 Comm: python3 Kdump: loaded Tainted: G           OE     -------  ---  6.12.0-54.el10.aarch64 \#1
Tainted: \[O\]=OOT\_MODULE, \[E\]=UNSIGNED\_MODULE
Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : refcount\_warn\_saturate+0xf4/0x148
lr : refcount\_warn\_saturate+0xf4/0x148
sp : ffff80008b81b7e0
x29: ffff80008b81b7e0 x28: ffff000133d51600 x27: 0000000000000001
x26: 0000000000000000 x25: 00000000ffffffea x24: ffff00010ae80f00
x23: ffff00010ae80f80 x22: ffff0000c66e5d08 x21: 0000000000000000
x20: ffff0000c66e0000 x19: ffff00010ae80340 x18: 0000000000000006
x17: 0000000000000000 x16: 0000000000000020 x15: ffff80008b81b37f
x14: 0000000000000000 x13: 2e656572662d7265 x12: ffff80008283ef78
x11: ffff80008257efd0 x10: ffff80008283efd0 x9 : ffff80008021ed90
x8 : 0000000000000001 x7 : 00000000000bffe8 x6 : c0000000ffff7fff
x5 : ffff0001fb8e3408 x4 : 0000000000000000 x3 : ffff800179993000
x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff000133d51600
Call trace:
 refcount\_warn\_saturate+0xf4/0x148
 mlx5\_core\_put\_rsc+0x88/0xa0 \[mlx5\_ib\]
 mlx5\_core\_destroy\_rq\_tracked+0x64/0x98 \[mlx5\_ib\]
 mlx5\_ib\_destroy\_wq+0x34/0x80 \[mlx5\_ib\]
 ib\_destroy\_wq\_user+0x30/0xc0 \[ib\_core\]
 uverbs\_free\_wq+0x28/0x58 \[ib\_uverbs\]
 destroy\_hw\_idr\_uobject+0x34/0x78 \[ib\_uverbs\]
 uverbs\_destroy\_uobject+0x48/0x240 \[ib\_uverbs\]
 \_\_uverbs\_cleanup\_ufile+0xd4/0x1a8 \[ib\_uverbs\]
 uverbs\_destroy\_ufile\_hw+0x48/0x120 \[ib\_uverbs\]
 ib\_uverbs\_close+0x2c/0x100 \[ib\_uverbs\]
 \_\_fput+0xd8/0x2f0
 \_\_fput\_sync+0x50/0x70
 \_\_arm64\_sys\_close+0x40/0x90
 invoke\_syscall.constprop.0+0x74/0xd0
 do\_el0\_svc+0x48/0xe8
 el0\_svc+0x44/0x1d0
 el0t\_64\_sync\_handler+0x120/0x130
 el0t\_64\_sync+0x1a4/0x1a8

## Affected and fixed versions

- Linux: \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 26d2f662d3a6655a82fd8a287e8b1ce471567f36; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< f9784da76ad7be66230e829e743bdf68a2c49e56; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< cf32affe6f3801cfb72a65e69c4bc7a8ee9be100; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 7c4c84cdcc19e89d42f6bf117238e5471173423e; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 50ac361ff8914133e3cf6ef184bac90c22cb8d79; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 0a7790cbba654e925243571cf2f24d61603d3ed3; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6 (cvelist)
- Linux: 4.5 (cvelist)

## Mitigation

- Upgrade Linux to 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6 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-38161. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2025-38161.md
Affected: Linux >= e2013b212f9f201c71fc5826ce41f39ebece0852, < 26d2f662d3a6655a82fd8a287e8b1ce471567f36; >= e2013b212f9f201c71fc5826ce41f39ebece0852, < f9784da76ad7be66230e829e743bdf68a2c49e56; >= e2013b212f9f201c71fc5826ce41f39ebece0852, < cf32affe6f3801cfb72a65e69c4bc7a8ee9be100; >= e2013b212f9f201c71fc582…
Fixed in: Linux 26d2f662d3a6655a82fd8a287e8b1ce471567f36, Linux 7c4c84cdcc19e89d42f6bf117238e5471173423e, Linux 50ac361ff8914133e3cf6ef184bac90c22cb8d79, Linux 0a7790cbba654e925243571cf2f24d61603d3ed3, Linux 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6

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-38161 being exploited?

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

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

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

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

Linux \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 26d2f662d3a6655a82fd8a287e8b1ce471567f36; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< f9784da76ad7be66230e829e743bdf68a2c49e56; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< cf32affe6f3801cfb72a65e69c4bc7a8ee9be100; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 7c4c84cdcc19e89d42f6bf117238e5471173423e; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 50ac361ff8914133e3cf6ef184bac90c22cb8d79; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 0a7790cbba654e925243571cf2f24d61603d3ed3; \>= e2013b212f9f201c71fc5826ce41f39ebece0852, \< 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6; Linux 4.5.

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

Yes. Fixed in Linux 26d2f662d3a6655a82fd8a287e8b1ce471567f36, Linux 7c4c84cdcc19e89d42f6bf117238e5471173423e, Linux 50ac361ff8914133e3cf6ef184bac90c22cb8d79, Linux 0a7790cbba654e925243571cf2f24d61603d3ed3, Linux 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6. Upgrade Linux to 5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6 or later.

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

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/26d2f662d3a6655a82fd8a287e8b1ce471567f36>
- patch: <https://git.kernel.org/stable/c/f9784da76ad7be66230e829e743bdf68a2c49e56>
- patch: <https://git.kernel.org/stable/c/cf32affe6f3801cfb72a65e69c4bc7a8ee9be100>
- patch: <https://git.kernel.org/stable/c/7c4c84cdcc19e89d42f6bf117238e5471173423e>
- patch: <https://git.kernel.org/stable/c/50ac361ff8914133e3cf6ef184bac90c22cb8d79>
- patch: <https://git.kernel.org/stable/c/0a7790cbba654e925243571cf2f24d61603d3ed3>
- patch: <https://git.kernel.org/stable/c/5d2ea5aebbb2f3ebde4403f9c55b2b057e5dd2d6>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00008.html>
- other: <https://lists.debian.org/debian-lts-announce/2025/10/msg00007.html>

## 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-38161>

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