CVE-2025-40039 Details
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.
A race condition vulnerability has been identified in the ksmbd component of the Linux kernel, specifically in how RPC handles are managed within sessions. The vulnerability arises from improper locking mechanisms that are meant to protect access to the 'rpc_handle_list' XArray, which organizes RPC handles for each ksmbd session. The issue allows for potential concurrent modifications that could lead to data corruption or inconsistent reads. In the function 'ksmbd_session_rpc_open()', only a read lock was applied before modifying the XArray, whereas a write lock was necessary to ensure exclusive access. Additionally, the function 'ksmbd_session_rpc_method()' accessed the handle list without any locking, risking a use-after-free scenario if an entry was removed while being referenced.
The vulnerability has been addressed by modifying the 'ksmbd_session_rpc_open()' function to use write locks for exclusive access during XArray modifications, and by adding read locks in the 'ksmbd_session_rpc_method()' function' to safely protect data lookups.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
No SSVC data is available for this CVE.
References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://git.kernel.org/stable/c/305853cce379407090a73b38c5de5ba748893aee | kernel.org | Patch |
| https://git.kernel.org/stable/c/5cc679ba0f4505936124cd4179ba66bb0a4bd9f3 | kernel.org | Patch |
| https://git.kernel.org/stable/c/69674b029002b1d90b655f014bdf64f404efa54d | kernel.org | Patch |
| https://git.kernel.org/stable/c/6b615a8fb3af0baf8126cde3d4fee97d57222ffc | kernel.org | Patch |
| https://git.kernel.org/stable/c/6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1 | kernel.org | Patch |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-362 | Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| linux linux kernel | >= 5.15.145, < 5.16 >= 6.1.71, < 6.2 >= 6.3, < 6.6.123 >= 6.7, < 6.12.53 >= 6.13, < 6.17.3 |
CPE
Remediation
| |
Change History
6 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Oct 19, 2026 | CVE Translated | [email protected] |
| Jul 30, 2026 | CVE Modified | kernel.org |
| Jun 17, 2026 | CVE Modified | kernel.org |
| Feb 26, 2026 | Initial Analysis | [email protected] |
| Feb 6, 2026 | CVE Modified | kernel.org |
| Oct 28, 2025 | New CVE Received | kernel.org |