# CVE-2024-42152: nvmet: fix a possible leak when destroy a ctrl during qp establishment

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

- **Severity:** HIGH 7.5
- **CVSS:** 7.5 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; 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:** Remote, no login needed
- **EPSS:** 0.99% (percentile 61, 2026-11-26)
- **CWE:** CWE-401
- **Published:** 2024-07-30T07:46:44.795Z
- **Modified:** 2026-08-05T11:35:52.904Z

## Who should check

- Anyone running Linux \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 2f3c22b1d3d7e86712253244797a651998c141fa; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< b4fed1443a6571d49c6ffe7d97af3bbe5ee6dff5; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 940a71f08ef153ef807f751310b0648d1fa5d0da; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 5502c1f1d0d7472706cc1f201aecf1c935d302d1; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 818004f2a380420c19872171be716174d4985e33; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< c758b77d4a0a0ed3a1292b3fd7a2aeccd1a169a4
- Anyone running Linux 5.6

## Description

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

nvmet: fix a possible leak when destroy a ctrl during qp establishment

In nvmet\_sq\_destroy we capture sq-\>ctrl early and if it is non-NULL we
know that a ctrl was allocated (in the admin connect request handler)
and we need to release pending AERs, clear ctrl-\>sqs and sq-\>ctrl
(for nvme-loop primarily), and drop the final reference on the ctrl.

However, a small window is possible where nvmet\_sq\_destroy starts (as
a result of the client giving up and disconnecting) concurrently with
the nvme admin connect cmd (which may be in an early stage). But \*before\*
kill\_and\_confirm of sq-\>ref (i.e. the admin connect managed to get an sq
live reference). In this case, sq-\>ctrl was allocated however after it was
captured in a local variable in nvmet\_sq\_destroy.
This prevented the final reference drop on the ctrl.

Solve this by re-capturing the sq-\>ctrl after all inflight request has
completed, where for sure sq-\>ctrl reference is final, and move forward
based on that.

This issue was observed in an environment with many hosts connecting
multiple ctrls simoutanuosly, creating a delay in allocating a ctrl
leading up to this race window.

## Affected and fixed versions

- Linux: \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 2f3c22b1d3d7e86712253244797a651998c141fa; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< b4fed1443a6571d49c6ffe7d97af3bbe5ee6dff5; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 940a71f08ef153ef807f751310b0648d1fa5d0da; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 5502c1f1d0d7472706cc1f201aecf1c935d302d1; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 818004f2a380420c19872171be716174d4985e33; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< c758b77d4a0a0ed3a1292b3fd7a2aeccd1a169a4 (cvelist)
- Linux: 5.6 (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-2024-42152. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-42152.md
Affected: Linux >= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, < 2f3c22b1d3d7e86712253244797a651998c141fa; >= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, < b4fed1443a6571d49c6ffe7d97af3bbe5ee6dff5; >= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, < 940a71f08ef153ef807f751310b0648d1fa5d0da; >= 0f5be6a4ff7b3f8bf3db15f…
Fixed in: Linux 2f3c22b1d3d7e86712253244797a651998c141fa, Linux 940a71f08ef153ef807f751310b0648d1fa5d0da, Linux 5502c1f1d0d7472706cc1f201aecf1c935d302d1, Linux 818004f2a380420c19872171be716174d4985e33

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-2024-42152 being exploited?

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

### How serious is CVE-2024-42152?

High: CVSS 7.5 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2024-42152?

Linux \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 2f3c22b1d3d7e86712253244797a651998c141fa; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< b4fed1443a6571d49c6ffe7d97af3bbe5ee6dff5; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 940a71f08ef153ef807f751310b0648d1fa5d0da; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 5502c1f1d0d7472706cc1f201aecf1c935d302d1; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< 818004f2a380420c19872171be716174d4985e33; \>= 0f5be6a4ff7b3f8bf3db15f904e3e76797a43d9a, \< c758b77d4a0a0ed3a1292b3fd7a2aeccd1a169a4; Linux 5.6.

### Is there a fix for CVE-2024-42152?

Yes. Fixed in Linux 2f3c22b1d3d7e86712253244797a651998c141fa, Linux 940a71f08ef153ef807f751310b0648d1fa5d0da, Linux 5502c1f1d0d7472706cc1f201aecf1c935d302d1, Linux 818004f2a380420c19872171be716174d4985e33. No fix listed yet: follow the vendor advisory.

### How do I check if I'm affected by CVE-2024-42152?

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/2f3c22b1d3d7e86712253244797a651998c141fa>
- patch: <https://git.kernel.org/stable/c/b4fed1443a6571d49c6ffe7d97af3bbe5ee6dff5>
- patch: <https://git.kernel.org/stable/c/940a71f08ef153ef807f751310b0648d1fa5d0da>
- patch: <https://git.kernel.org/stable/c/5502c1f1d0d7472706cc1f201aecf1c935d302d1>
- patch: <https://git.kernel.org/stable/c/818004f2a380420c19872171be716174d4985e33>
- patch: <https://git.kernel.org/stable/c/c758b77d4a0a0ed3a1292b3fd7a2aeccd1a169a4>
- other: <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.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-2024-42152>

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