CVE-2025-40039
MediumIn 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.
CVSS 3.1 score
4.7
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
Weakness type
CWE-362CVE-2025-40039 is a Race Condition vulnerability
What is Race Condition?
The product contains a code sequence that can run concurrently with other code, creating unexpected states. Learn more on MITRE CWE
Affected versions
Linux kernel versions
5.15.145,
6.3
and later are affected. Fixed in
6.6.123,
6.12.53,
6.17.3,
6.18
and their respective stable series.
References
The following references provide additional information about CVE-2025-40039 including vendor advisories, patch commits, exploit details, and third-party analysis. Links are sourced from the NIST NVD database.
-
PatchKernel patch commithttps://git.kernel.org/stable/c/305853cce379407090a73b38c5de5ba748893aee
-
PatchKernel patch commithttps://git.kernel.org/stable/c/5cc679ba0f4505936124cd4179ba66bb0a4bd9f3
-
PatchKernel patch commithttps://git.kernel.org/stable/c/69674b029002b1d90b655f014bdf64f404efa54d
Frequently asked questions
-
What is CVE-2025-40039?
CVE-2025-40039 is a Medium severity Linux kernel vulnerability with a CVSS score of 4.7 out of 10 , classified as a Race Condition flaw (CWE-362) . It affects Linux kernel versions from 5.15.145 onward and has been patched in 6.6.123, 6.12.53, 6.17.3 and others. CVE-2025-40039 has not been confirmed as actively exploited and is not listed in the CISA KEV catalog.
-
What is the CVSS score for CVE-2025-40039?
CVE-2025-40039 has a CVSS score of 4.7 out of 10, rated Medium severity (CVSS 3.1). The vector string is
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H. -
Is there a patch available for CVE-2025-40039?
Yes — CVE-2025-40039 has been patched. Fixed versions include 6.6.123, 6.12.53, 6.17.3 and others. If you are running Linux kernel 5.15.145 or later up to the fix versions, apply the relevant patch for your kernel branch.
-
Is CVE-2025-40039 actively exploited?
No — CVE-2025-40039 has not been confirmed as actively exploited. It is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.
-
What is Race Condition (CWE-362)?
The product contains a code sequence that can run concurrently with other code, creating unexpected states. View CWE-362 on MITRE CWE →