CVE-2025-40039
ksmbd: Fix race condition in RPC handle list access
Mitigation
- Upgrade Linux to 5.16 or later.
Who should check
- Anyone running Linux >= a4348710a7267705b75692dc1a000920481d1d92, < 69674b029002b1d90b655f014bdf64f404efa54d; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6b615a8fb3af0baf8126cde3d4fee97d57222ffc; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 305853cce379407090a73b38c5de5ba748893aee; 1f485b54d04a920723984062c912174330a05178; 052b41ef2abe274f068e892aee81406f11bd1f3a; >= 5.15.145, < 5.16
- Anyone running Linux 6.3
Vulnerability facts
- Affected
- Linux >= a4348710a7267705b75692dc1a000920481d1d92, < 69674b029002b1d90b655f014bdf64f404efa54d; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6b615a8fb3af0baf8126cde3d4fee97d57222ffc; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 305853cce379407090a73b38c5de5ba748893aee; 1f485b54d04a920723984062c912174330a05178; 052b41ef2abe274f068e892aee81406f11bd1f3a; >= 5.15.145, < 5.16; Linux 6.3
- Fixed in
- Linux 69674b029002b1d90b655f014bdf64f404efa54d, Linux 6b615a8fb3af0baf8126cde3d4fee97d57222ffc, Linux 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3, Linux 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1, Linux 305853cce379407090a73b38c5de5ba748893aee, Linux 5.16
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, login needed
- CVSS
- 8.8 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: Low
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 0.39% chance of exploitation in 30 days (percentile 25, 2026-11-26)
- CWE
- CWE-362
- Modified
Description
In the Linux kernel, the following vulnerability has been resolved: ksmbd: Fix race condition in RPC handle list access The 'sess->rpc_handle_list' XArray manages RPC handles within a ksmbd session. Access to this list is intended to be protected by 'sess->rpc_lock' (an rw_semaphore). However, the locking implementation was flawed, leading to potential race conditions. In ksmbd_session_rpc_open(), the code incorrectly acquired only a read lock before calling xa_store() and xa_erase(). Since these operations modify the XArray structure, a write lock is required to ensure exclusive access and prevent data corruption from concurrent modifications. Furthermore, ksmbd_session_rpc_method() accessed the list using xa_load() without holding any lock at all. This could lead to reading inconsistent data or a potential use-after-free if an entry is concurrently removed and the pointer is dereferenced. Fix these issues by: 1. Using down_write() and up_write() in ksmbd_session_rpc_open() to ensure exclusive access during XArray modification, and ensuring the lock is correctly released on error paths. 2. Adding down_read() and up_read() in ksmbd_session_rpc_method() to safely protect the lookup.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| Linux | >= a4348710a7267705b75692dc1a000920481d1d92, < 69674b029002b1d90b655f014bdf64f404efa54d; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6b615a8fb3af0baf8126cde3d4fee97d57222ffc; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 305853cce379407090a73b38c5de5ba748893aee; 1f485b54d04a920723984062c912174330a05178; 052b41ef2abe274f068e892aee81406f11bd1f3a; >= 5.15.145, < 5.16 | — | cvelist |
| Linux | 6.3 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2025-40039. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2025-40039.md Affected: Linux >= a4348710a7267705b75692dc1a000920481d1d92, < 69674b029002b1d90b655f014bdf64f404efa54d; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6b615a8fb3af0baf8126cde3d4fee97d57222ffc; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3; >= b685757c7b08d5073046fb3… Fixed in: Linux 69674b029002b1d90b655f014bdf64f404efa54d, Linux 6b615a8fb3af0baf8126cde3d4fee97d57222ffc, Linux 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3, Linux 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1, Linux 305853cce379407090a73b38c5de5ba748893aee, Linux 5.16 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.
References
Patches
- https://git.kernel.org/stable/c/69674b029002b1d90b655f014bdf64f404efa54d
- https://git.kernel.org/stable/c/6b615a8fb3af0baf8126cde3d4fee97d57222ffc
- https://git.kernel.org/stable/c/5cc679ba0f4505936124cd4179ba66bb0a4bd9f3
- https://git.kernel.org/stable/c/6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1
- https://git.kernel.org/stable/c/305853cce379407090a73b38c5de5ba748893aee
FAQ
Is CVE-2025-40039 being exploited?
There is no confirmed exploitation: CVE-2025-40039 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.39% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2025-40039?
High: CVSS 8.8 (v3.1, scored by CNA). Remote, login needed.
Which versions are affected by CVE-2025-40039?
Linux >= a4348710a7267705b75692dc1a000920481d1d92, < 69674b029002b1d90b655f014bdf64f404efa54d; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6b615a8fb3af0baf8126cde3d4fee97d57222ffc; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1; >= b685757c7b08d5073046fb379be965fd6c06aafc, < 305853cce379407090a73b38c5de5ba748893aee; 1f485b54d04a920723984062c912174330a05178; 052b41ef2abe274f068e892aee81406f11bd1f3a; >= 5.15.145, < 5.16; Linux 6.3.
Is there a fix for CVE-2025-40039?
Yes. Fixed in Linux 69674b029002b1d90b655f014bdf64f404efa54d, Linux 6b615a8fb3af0baf8126cde3d4fee97d57222ffc, Linux 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3, Linux 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1, Linux 305853cce379407090a73b38c5de5ba748893aee, Linux 5.16. Upgrade Linux to 5.16 or later.
How do I check if I'm affected by CVE-2025-40039?
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.