Vulnerability · Published Oct 28, 2025 · Assigned by Linux
CVE-2025-40039ksmbd: Fix race condition in RPC handle list access
High 8.8
In plain English
A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 24% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official 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 packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.162-1 | DSA-6127-1 |
| Debian:12 | linux | 6.1.162-1 | DEBIAN-CVE-2025-40039 |
| Debian:13 | linux | 6.12.57-1 | DEBIAN-CVE-2025-40039 |
| Debian:14 | linux | 6.17.6-1 | DEBIAN-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux | 6.8.0-117.117 | USN-8278-1 |
| Ubuntu:24.04:LTS | linux | 6.8.0-117.117 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux | 6.17.0-14.14 | USN-8029-1 |
| Ubuntu:25.10 | linux | 6.17.0-14.14 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-aws | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1055.58 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1055.58 | USN-8278-1 |
| Ubuntu:25.10 | linux-aws | 6.17.0-1007.7 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-aws | 6.17.0-1007.7 | USN-8029-2 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-aws-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-aws-6.17 | 6.17.0-1007.7~24.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1057.60~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1056.62 | USN-8278-2 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1056.62 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-azure | 6.17.0-1008.8 | USN-8029-3 |
| Ubuntu:25.10 | linux-azure | 6.17.0-1008.8 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure-6.11 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1059.65~22.04.1 | USN-8440-1 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1059.65~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-fde | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure-fde | 6.8.0-1058.65 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-azure-fde | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure-fde-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.8 | 6.8.0-1058.65~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure-nvidia | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-azure-nvidia-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-gcp | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1058.61 | USN-8278-1 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1058.61 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-gcp | 6.17.0-1007.7 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-gcp | 6.17.0-1007.7 | USN-8030-1 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gcp-6.11 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gcp-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gcp-6.17 | 6.17.0-1008.8~24.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1060.63~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-gke | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1054.60 | USN-8278-1 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1054.60 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-gkeop | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1041.44 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1041.44 | USN-8278-1 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-hwe-6.11 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-hwe-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-124.124~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-ibm | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1055.56 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1055.56 | USN-8278-1 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | 6.8.0-1055.56~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-ibm-6.8 | 6.8.0-1055.56~22.04.1 | USN-8278-1 |
| Ubuntu:22.04:LTS | linux-intel-iot-realtime | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-intel-iotg | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-kvm | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-lowlatency | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-117.117.1 | USN-8278-1 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-117.117.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-lowlatency-hwe-6.11 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-117.117.1~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-117.117.1~22.04.1 | USN-8278-1 |
| Ubuntu:22.04:LTS | linux-nvidia | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1054.57 | USN-8289-1 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1054.57 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-nvidia-6.11 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-nvidia-6.17 | 6.17.0-1008.8 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1054.57~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1054.57~22.04.1 | USN-8289-2 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1054.57.1 | USN-8289-1 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1054.57.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-nvidia-tegra | 6.8.0-1024.24 | USN-8296-2 |
| Ubuntu:24.04:LTS | linux-nvidia-tegra | 6.8.0-1024.24 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-nvidia-tegra-igx | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oem-6.11 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oem-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oem-6.17 | 6.17.0-1011.11 | USN-8048-1 |
| Ubuntu:24.04:LTS | linux-oem-6.17 | 6.17.0-1011.11 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oracle | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1054.55 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-oracle | 6.17.0-1007.7 | USN-8029-2 |
| Ubuntu:25.10 | linux-oracle | 6.17.0-1007.7 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oracle-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-oracle-6.17 | 6.17.0-1007.7~24.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1054.55~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-raspi | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1056.60 | USN-8278-1 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1056.60 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-raspi | 6.17.0-1008.8 | USN-8029-1 |
| Ubuntu:25.10 | linux-raspi | 6.17.0-1008.8 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-raspi-realtime | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-realtime | 6.17.0-1006.7 | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-realtime | 6.17.0-1006.7 | USN-8029-1 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:25.10 | linux-riscv | 6.17.0-14.14.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-riscv-6.14 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-117.117~22.04.1 | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-xilinx | 6.8.0-1032.33 | UBUNTU-CVE-2025-40039 |
| Ubuntu:24.04:LTS | linux-xilinx | 6.8.0-1032.33 | USN-8499-1 |
| Ubuntu:22.04:LTS | linux-xilinx-zynqmp | no fix listed | UBUNTU-CVE-2025-40039 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | a4348710a7267705b75692dc1a000920481d1d92 – before 69674b029002b1d90b655f014bdf64f404efa54db685757c7b08d5073046fb379be965fd6c06aafc – before 6b615a8fb3af0baf8126cde3d4fee97d57222ffcb685757c7b08d5073046fb379be965fd6c06aafc – before 5cc679ba0f4505936124cd4179ba66bb0a4bd9f3b685757c7b08d5073046fb379be965fd6c06aafc – before 6bd7e0e55dcea2cf0d391bbc21c2eb069b4be3e1b685757c7b08d5073046fb379be965fd6c06aafc – before 305853cce379407090a73b38c5de5ba748893aee1f485b54d04a920723984062c912174330a05178052b41ef2abe274f068e892aee81406f11bd1f3a5.15.145 – before 5.16 |
| Linux | Linux | 6.3 |
References
- 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