CVE-2025-40342
Description
In the Linux kernel, the following vulnerability has been resolved:
nvme-fc: use lock accessing port_state and rport state
nvme_fc_unregister_remote removes the remote port on a lport object at any point in time when there is no active association. This races with with the reconnect logic, because nvme_fc_create_association is not taking a lock to check the port_state and atomically increase the active count on the rport.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
In the Linux kernel's nvme-fc driver, a race condition between remote port removal and association creation can lead to use-after-free or NULL pointer dereference.
Vulnerability
CVE-2025-40342 is a race condition in the Linux kernel's NVMe over Fibre Channel (nvme-fc) driver. The function nvme_fc_unregister_remote can remove a can remove a remote port from a local port object at any time when there is no active association. This removal races with the reconnect logic in nvme_fc_create_association, which does not hold a lock to check the port_state and atomically increment_state and atomically increment the active count on the remote port [1][2].
An attacker with the race, an attacker with local access or the ability to trigger a remote port removal (e.g., through fabric events) could cause the reconnect code to operate on a stale or freed remote port structure. The lack of proper locking means the association creation can proceed after the port has been removed, leading to a use-after-free or NULL pointer dereference or NULL pointer dereference [3][4].
Successful exploitation could result in a kernel crash (denial of service) or potentially arbitrary code execution in the kernel context, depending on the memory layout and attacker control. The vulnerability is present in the Linux kernel versions prior to the fix.
The fix has been applied in the upstream Linux kernel via commits that add proper locking around the port state checks and active count increments. Users should update to a kernel version containing the fix or apply the relevant patches from the stable tree [1][2][3][4].
AI Insight generated on May 19, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
2Patches
7de3d91af47bce8cde03de8674253e0a4546125f4bf1f79799950af430394a2f7fa75c4a2891cdbb162ccVulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
7- git.kernel.org/stable/c/25f4bf1f7979a7871974fd36c79d69ff1cf4b446nvd
- git.kernel.org/stable/c/4253e0a4546138a2bf9cb6acf66b32fee677fc7cnvd
- git.kernel.org/stable/c/891cdbb162ccdb079cd5228ae43bdeebce8597adnvd
- git.kernel.org/stable/c/9950af4303942081dc8c7a5fdc3688c17c7eb6c0nvd
- git.kernel.org/stable/c/a2f7fa75c4a2a07328fa22ccbef461db76790b55nvd
- git.kernel.org/stable/c/de3d91af47bc015031e7721b100a29989f6498a5nvd
- git.kernel.org/stable/c/e8cde03de8674b05f2c5e0870729049eba517800nvd
News mentions
0No linked articles in our index yet.