CVE-2025-40039
Severity CVSS v4.0:
Pending analysis
Type:
CWE-362
Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition')
Publication date:
28/10/2025
Last modified:
26/02/2026
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ksmbd: Fix race condition in RPC handle list access<br />
<br />
The &#39;sess->rpc_handle_list&#39; XArray manages RPC handles within a ksmbd<br />
session. Access to this list is intended to be protected by<br />
&#39;sess->rpc_lock&#39; (an rw_semaphore). However, the locking implementation was<br />
flawed, leading to potential race conditions.<br />
<br />
In ksmbd_session_rpc_open(), the code incorrectly acquired only a read lock<br />
before calling xa_store() and xa_erase(). Since these operations modify<br />
the XArray structure, a write lock is required to ensure exclusive access<br />
and prevent data corruption from concurrent modifications.<br />
<br />
Furthermore, ksmbd_session_rpc_method() accessed the list using xa_load()<br />
without holding any lock at all. This could lead to reading inconsistent<br />
data or a potential use-after-free if an entry is concurrently removed and<br />
the pointer is dereferenced.<br />
<br />
Fix these issues by:<br />
1. Using down_write() and up_write() in ksmbd_session_rpc_open()<br />
to ensure exclusive access during XArray modification, and ensuring<br />
the lock is correctly released on error paths.<br />
2. Adding down_read() and up_read() in ksmbd_session_rpc_method()<br />
to safely protect the lookup.
Impact
Base Score 3.x
4.70
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.15.145 (including) | 5.16 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.1.71 (including) | 6.2 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.3 (including) | 6.6.123 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.12.53 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.13 (including) | 6.17.3 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/305853cce379407090a73b38c5de5ba748893aee
- https://git.kernel.org/stable/c/5cc679ba0f4505936124cd4179ba66bb0a4bd9f3
- https://git.kernel.org/stable/c/69674b029002b1d90b655f014bdf64f404efa54d
- https://git.kernel.org/stable/c/6b615a8fb3af0baf8126cde3d4fee97d57222ffc
- https://git.kernel.org/stable/c/6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1



