# CVE-2022-50726: net/mlx5: Fix possible use-after-free in async command interface

> 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.23% (percentile 8, 2026-11-26)
- **Published:** 2025-12-24T12:22:47.625Z
- **Modified:** 2026-08-05T08:59:30.034Z

## Who should check

- Anyone running Linux \>= e355477ed9e4f401e3931043df97325d38552d54, \< 69dd3ad406c49aa69ce4852c15231ac56af8caf9; \>= e355477ed9e4f401e3931043df97325d38552d54, \< bbcc06933f35651294ea1e963757502312c2171f; \>= e355477ed9e4f401e3931043df97325d38552d54, \< ab3de780c176bb91995c6166a576b370d9726e17; \>= e355477ed9e4f401e3931043df97325d38552d54, \< 0aa3ee1e4e5c9ed5dda11249450d609c3072c54e; \>= e355477ed9e4f401e3931043df97325d38552d54, \< bacd22df95147ed673bec4692ab2d4d585935241
- Anyone running Linux 5.1

## Description

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

net/mlx5: Fix possible use-after-free in async command interface

mlx5\_cmd\_cleanup\_async\_ctx should return only after all its callback
handlers were completed. Before this patch, the below race between
mlx5\_cmd\_cleanup\_async\_ctx and mlx5\_cmd\_exec\_cb\_handler was possible and
lead to a use-after-free:

1. mlx5\_cmd\_cleanup\_async\_ctx is called while num\_inflight is 2 (i.e.
   elevated by 1, a single inflight callback).
2. mlx5\_cmd\_cleanup\_async\_ctx decreases num\_inflight to 1.
3. mlx5\_cmd\_exec\_cb\_handler is called, decreases num\_inflight to 0 and
   is about to call wake\_up().
4. mlx5\_cmd\_cleanup\_async\_ctx calls wait\_event, which returns
   immediately as the condition (num\_inflight == 0) holds.
5. mlx5\_cmd\_cleanup\_async\_ctx returns.
6. The caller of mlx5\_cmd\_cleanup\_async\_ctx frees the mlx5\_async\_ctx
   object.
7. mlx5\_cmd\_exec\_cb\_handler goes on and calls wake\_up() on the freed
   object.

Fix it by syncing using a completion object. Mark it completed when
num\_inflight reaches 0.

Trace:

BUG: KASAN: use-after-free in do\_raw\_spin\_lock+0x23d/0x270
Read of size 4 at addr ffff888139cd12f4 by task swapper/5/0

CPU: 5 PID: 0 Comm: swapper/5 Not tainted 6.0.0-rc3\_for\_upstream\_debug\_2022\_08\_30\_13\_10 \#1
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
Call Trace:
 \<IRQ\>
 dump\_stack\_lvl+0x57/0x7d
 print\_report.cold+0x2d5/0x684
 ? do\_raw\_spin\_lock+0x23d/0x270
 kasan\_report+0xb1/0x1a0
 ? do\_raw\_spin\_lock+0x23d/0x270
 do\_raw\_spin\_lock+0x23d/0x270
 ? rwlock\_bug.part.0+0x90/0x90
 ? \_\_delete\_object+0xb8/0x100
 ? lock\_downgrade+0x6e0/0x6e0
 \_raw\_spin\_lock\_irqsave+0x43/0x60
 ? \_\_wake\_up\_common\_lock+0xb9/0x140
 \_\_wake\_up\_common\_lock+0xb9/0x140
 ? \_\_wake\_up\_common+0x650/0x650
 ? destroy\_tis\_callback+0x53/0x70 \[mlx5\_core\]
 ? kasan\_set\_track+0x21/0x30
 ? destroy\_tis\_callback+0x53/0x70 \[mlx5\_core\]
 ? kfree+0x1ba/0x520
 ? do\_raw\_spin\_unlock+0x54/0x220
 mlx5\_cmd\_exec\_cb\_handler+0x136/0x1a0 \[mlx5\_core\]
 ? mlx5\_cmd\_cleanup\_async\_ctx+0x220/0x220 \[mlx5\_core\]
 ? mlx5\_cmd\_cleanup\_async\_ctx+0x220/0x220 \[mlx5\_core\]
 mlx5\_cmd\_comp\_handler+0x65a/0x12b0 \[mlx5\_core\]
 ? dump\_command+0xcc0/0xcc0 \[mlx5\_core\]
 ? lockdep\_hardirqs\_on\_prepare+0x400/0x400
 ? cmd\_comp\_notifier+0x7e/0xb0 \[mlx5\_core\]
 cmd\_comp\_notifier+0x7e/0xb0 \[mlx5\_core\]
 atomic\_notifier\_call\_chain+0xd7/0x1d0
 mlx5\_eq\_async\_int+0x3ce/0xa20 \[mlx5\_core\]
 atomic\_notifier\_call\_chain+0xd7/0x1d0
 ? irq\_release+0x140/0x140 \[mlx5\_core\]
 irq\_int\_handler+0x19/0x30 \[mlx5\_core\]
 \_\_handle\_irq\_event\_percpu+0x1f2/0x620
 handle\_irq\_event+0xb2/0x1d0
 handle\_edge\_irq+0x21e/0xb00
 \_\_common\_interrupt+0x79/0x1a0
 common\_interrupt+0x78/0xa0
 \</IRQ\>
 \<TASK\>
 asm\_common\_interrupt+0x22/0x40
RIP: 0010:default\_idle+0x42/0x60
Code: c1 83 e0 07 48 c1 e9 03 83 c0 03 0f b6 14 11 38 d0 7c 04 84 d2 75 14 8b 05 eb 47 22 02 85 c0 7e 07 0f 00 2d e0 9f 48 00 fb f4 \<c3\> 48 c7 c7 80 08 7f 85 e8 d1 d3 3e fe eb de 66 66 2e 0f 1f 84 00
RSP: 0018:ffff888100dbfdf0 EFLAGS: 00000242
RAX: 0000000000000001 RBX: ffffffff84ecbd48 RCX: 1ffffffff0afe110
RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffffffff835cc9bc
RBP: 0000000000000005 R08: 0000000000000001 R09: ffff88881dec4ac3
R10: ffffed1103bd8958 R11: 0000017d0ca571c9 R12: 0000000000000005
R13: ffffffff84f024e0 R14: 0000000000000000 R15: dffffc0000000000
 ? default\_idle\_call+0xcc/0x450
 default\_idle\_call+0xec/0x450
 do\_idle+0x394/0x450
 ? arch\_cpu\_idle\_exit+0x40/0x40
 ? do\_idle+0x17/0x450
 cpu\_startup\_entry+0x19/0x20
 start\_secondary+0x221/0x2b0
 ? set\_cpu\_sibling\_map+0x2070/0x2070
 secondary\_startup\_64\_no\_verify+0xcd/0xdb
 \</TASK\>

Allocated by task 49502:
 kasan\_save\_stack+0x1e/0x40
 \_\_kasan\_kmalloc+0x81/0xa0
 kvmalloc\_node+0x48/0xe0
 mlx5e\_bulk\_async\_init+0x35/0x110 \[mlx5\_core\]
 mlx5e\_tls\_priv\_tx\_list\_cleanup+0x84/0x3e0 \[mlx5\_core\]
 mlx5e\_ktls\_cleanup\_tx+0x38f/0x760 \[mlx5\_core\]
 mlx5e\_cleanup\_nic\_tx+0xa7/0x100 \[mlx5\_core\]
 mlx5e\_detach\_netdev+0x1c
---truncated---

## Affected and fixed versions

- Linux: \>= e355477ed9e4f401e3931043df97325d38552d54, \< 69dd3ad406c49aa69ce4852c15231ac56af8caf9; \>= e355477ed9e4f401e3931043df97325d38552d54, \< bbcc06933f35651294ea1e963757502312c2171f; \>= e355477ed9e4f401e3931043df97325d38552d54, \< ab3de780c176bb91995c6166a576b370d9726e17; \>= e355477ed9e4f401e3931043df97325d38552d54, \< 0aa3ee1e4e5c9ed5dda11249450d609c3072c54e; \>= e355477ed9e4f401e3931043df97325d38552d54, \< bacd22df95147ed673bec4692ab2d4d585935241 (cvelist)
- Linux: 5.1 (cvelist)

## Mitigation

- No fix listed yet: follow the vendor advisory.

## Check your systems with an agent

Paste this into a coding agent:

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

Details: https://flawdb.com/CVE-2022-50726.md
Affected: Linux >= e355477ed9e4f401e3931043df97325d38552d54, < 69dd3ad406c49aa69ce4852c15231ac56af8caf9; >= e355477ed9e4f401e3931043df97325d38552d54, < bbcc06933f35651294ea1e963757502312c2171f; >= e355477ed9e4f401e3931043df97325d38552d54, < ab3de780c176bb91995c6166a576b370d9726e17; >= e355477ed9e4f401e393104…
Fixed in: Linux 69dd3ad406c49aa69ce4852c15231ac56af8caf9, Linux 0aa3ee1e4e5c9ed5dda11249450d609c3072c54e

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

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

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

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

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

Linux \>= e355477ed9e4f401e3931043df97325d38552d54, \< 69dd3ad406c49aa69ce4852c15231ac56af8caf9; \>= e355477ed9e4f401e3931043df97325d38552d54, \< bbcc06933f35651294ea1e963757502312c2171f; \>= e355477ed9e4f401e3931043df97325d38552d54, \< ab3de780c176bb91995c6166a576b370d9726e17; \>= e355477ed9e4f401e3931043df97325d38552d54, \< 0aa3ee1e4e5c9ed5dda11249450d609c3072c54e; \>= e355477ed9e4f401e3931043df97325d38552d54, \< bacd22df95147ed673bec4692ab2d4d585935241; Linux 5.1.

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

Yes. Fixed in Linux 69dd3ad406c49aa69ce4852c15231ac56af8caf9, Linux 0aa3ee1e4e5c9ed5dda11249450d609c3072c54e. No fix listed yet: follow the vendor advisory.

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

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

- other: <https://git.kernel.org/stable/c/69dd3ad406c49aa69ce4852c15231ac56af8caf9>
- other: <https://git.kernel.org/stable/c/bbcc06933f35651294ea1e963757502312c2171f>
- other: <https://git.kernel.org/stable/c/ab3de780c176bb91995c6166a576b370d9726e17>
- other: <https://git.kernel.org/stable/c/0aa3ee1e4e5c9ed5dda11249450d609c3072c54e>
- other: <https://git.kernel.org/stable/c/bacd22df95147ed673bec4692ab2d4d585935241>

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

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