# CVE-2022-48858: net/mlx5: Fix a race on command flush flow

- Severity: High 7.0 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.18%, higher than 7% of CVEs (2026-12-01)
- Published: 2024-07-16T12:25:23.123Z
- Modified: 2026-08-05T08:52:39.770Z
- Weaknesses: CWE-362, CWE-416
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## Description

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

net/mlx5: Fix a race on command flush flow

Fix a refcount use after free warning due to a race on command entry.
Such race occurs when one of the commands releases its last refcount and
frees its index and entry while another process running command flush
flow takes refcount to this command entry. The process which handles
commands flush may see this command as needed to be flushed if the other
process released its refcount but didn't release the index yet. Fix it
by adding the needed spin lock.

It fixes the following warning trace:

refcount_t: addition on 0; use-after-free.
WARNING: CPU: 11 PID: 540311 at lib/refcount.c:25 refcount_warn_saturate+0x80/0xe0
...
RIP: 0010:refcount_warn_saturate+0x80/0xe0
...
Call Trace:
 <TASK>
 mlx5_cmd_trigger_completions+0x293/0x340 [mlx5_core]
 mlx5_cmd_flush+0x3a/0xf0 [mlx5_core]
 enter_error_state+0x44/0x80 [mlx5_core]
 mlx5_fw_fatal_reporter_err_work+0x37/0xe0 [mlx5_core]
 process_one_work+0x1be/0x390
 worker_thread+0x4d/0x3d0
 ? rescuer_thread+0x350/0x350
 kthread+0x141/0x160
 ? set_kthread_struct+0x40/0x40
 ret_from_fork+0x1f/0x30
 </TASK>

(As written by CVE List.)

## Affected

- Linux Linux: from 073fff8102062cd675170ceb54d90da22fe7e668 before 1a4017926eeea56c7540cc41b42106746ee8a0ee; from 50b2412b7e7862c5af0cbf4b10d93bc5c712d021 before f3331bc17449f15832c31823f27573f4c0e13e5f; from 50b2412b7e7862c5af0cbf4b10d93bc5c712d021 before 7c519f769f555ff7d9d4ccba3497bbb589df360a; from 50b2412b7e7862c5af0cbf4b10d93bc5c712d021 before 0401bfb27a91d7bdd74b1635c1aae57cbb128da6; from 50b2412b7e7862c5af0cbf4b10d93bc5c712d021 before 063bd355595428750803d8736a9bb7c8db67d42d; da87ea137373689dec9d3fafa34a57787320a4b3; from 5.4.71 before 5.4.185; from 5.8.15 before 5.9; 5.9 (not affected: before 5.9; from 5.4.185 up to 5.4.*; from 5.10.106 up to 5.10.*; from 5.15.29 up to 5.15.*; from 5.16.15 up to 5.16.*; from 5.17 up to *)
- linux linux_kernel: before 5.4.185; from 5.5 before 5.10.106; from 5.11 before 5.15.29; from 5.16 before 5.16.15

## Every score

- Linux: CVSS:3.1 7.0 High `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.0 High `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <https://git.kernel.org/stable/c/1a4017926eeea56c7540cc41b42106746ee8a0ee> (patch)
- <https://git.kernel.org/stable/c/f3331bc17449f15832c31823f27573f4c0e13e5f> (patch)
- <https://git.kernel.org/stable/c/7c519f769f555ff7d9d4ccba3497bbb589df360a> (patch)
- <https://git.kernel.org/stable/c/0401bfb27a91d7bdd74b1635c1aae57cbb128da6> (patch)
- <https://git.kernel.org/stable/c/063bd355595428750803d8736a9bb7c8db67d42d> (patch)

## Sources

- CVE List: [CVE-2022-48858](https://www.cve.org/CVERecord?id=CVE-2022-48858), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2022-48858](https://nvd.nist.gov/vuln/detail/CVE-2022-48858), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2022-48858 · Whole record: https://cve.day/CVE-2022-48858.json · Rebuilt by cve.day 2026-11-25T22:58:19.922Z
