cve.bz

CVE-2025-40039 linux linux kernel: Race Condition

4.7 mediumEPSS 0.3%Fix available

Medium (4.7) in linux linux kernel. EPSS 0.3% estimated probability of exploitation activity in the next 30 days.

On this page
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.

Severity

CVSS 3.1

4.7 medium
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:H
EPSS
0.3% (unchanged from 0.3% a week ago; 0.3% 30 days ago) estimated probability of exploitation activity in the next 30 days; 24th percentile. Scored 2026-11-15. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-362 Concurrent Execution using Shared Resource with Improper Synchronization (Race Condition)
OWASP Top 10
A06:2025 Insecure Design
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2025-40039 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2025-40039?via=ask-ai-copy and https://cve.bz/cve/CVE-2025-40039?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2025-40039 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
Linuxfrom 5.15.145 before 5.16
Linux6.3 and later

Fixed in

ProductRelease lineFixed in
Linux6.66.6.123
Linux6.126.12.53
Linux6.176.17.3
Linuxlater releases6.18

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian11linux-6.16.1.162-1~deb11u1DLA-4476-1
Debian12linux6.1.162-1DEBIAN-CVE-2025-40039 DSA-6127-1
Debian13linux6.12.57-1DEBIAN-CVE-2025-40039
Debian14linux6.17.6-1DEBIAN-CVE-2025-40039
Ubuntu16.04:LTSlinux-hwe-edgeno fix listedUBUNTU-CVE-2025-40039
Ubuntu18.04:LTSlinux-gcp, linux-hwe, linux-oem and 12 moreno fix listedUBUNTU-CVE-2025-40039
Ubuntu20.04:LTSlinux-gke, linux-gkeop, linux-riscv and 26 moreno fix listedUBUNTU-CVE-2025-40039
Ubuntu22.04:LTSlinux, linux-aws, linux-gcp and 47 moreno fix listedUBUNTU-CVE-2025-40039
Ubuntu22.04:LTSlinux-aws-6.86.8.0-1057.60~22.04.1UBUNTU-CVE-2025-40039
Ubuntu22.04:LTSlinux-azure-6.86.8.0-1059.65~22.04.1UBUNTU-CVE-2025-40039 USN-8440-1
Ubuntu22.04:LTSlinux-azure-fde-6.86.8.0-1058.65~22.04.1UBUNTU-CVE-2025-40039
Ubuntu22.04:LTSlinux-gcp-6.86.8.0-1060.63~22.04.1UBUNTU-CVE-2025-40039
Ubuntu22.04:LTSlinux-hwe-6.86.8.0-124.124~22.04.1UBUNTU-CVE-2025-40039
Ubuntu22.04:LTSlinux-ibm-6.86.8.0-1055.56~22.04.1UBUNTU-CVE-2025-40039 USN-8278-1
Ubuntu22.04:LTSlinux-lowlatency-hwe-6.86.8.0-117.117.1~22.04.1UBUNTU-CVE-2025-40039 USN-8278-1
Ubuntu22.04:LTSlinux-nvidia-6.86.8.0-1054.57~22.04.1UBUNTU-CVE-2025-40039 USN-8289-2
43 more for Ubuntu in the JSON and on Ubuntu's page.
openSUSETumbleweedkernel-source6.17.7-1.1openSUSE-SU-2025:15702-1
openSUSETumbleweedkernel-source-longterm6.18.16-1.1openSUSE-SU-2026:10301-1
Azure Linux2kernelno fix listedAZL-78383
Alpaquita25linux-lts6.12.53-r0BELL-CVE-2025-40039
Alpaquitastreamlinux-lts6.18.35-r1BELL-CVE-2025-40039

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; SUSE security data, CC BY 4.0; Microsoft's Azure Linux vulnerability data, MIT; BellSoft's OSV database, MIT. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · openSUSE · Alpaquita.

Red Hat

Red Hat rates this Low.

Red Hat's statement

Red Hat Enterprise Linux kernels do not enable or ship the in-kernel SMB server (ksmbd), preventing exposure to this flaw on supported systems. In upstream environments, improper locking mechanisms during RPC handle operations allow concurrent access that can trigger race conditions, leading to data corruption or potential use-after-free states. Because the ksmbd subsystem is absent from Red Hat product kernels, this vulnerability does not impact Red Hat Enterprise Linux.

ProductPackageStateAdvisory
Red Hat Enterprise Linux 10kernelNot affected
Red Hat Enterprise Linux 6kernelNot affected
Red Hat Enterprise Linux 7kernelNot affected
Red Hat Enterprise Linux 7kernel-rtNot affected
Red Hat Enterprise Linux 8kernelNot affected
Red Hat Enterprise Linux 8kernel-rtNot affected
Red Hat Enterprise Linux 9kernelNot affected
Red Hat Enterprise Linux 9kernel-rtNot affected

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2025-40039.

Attack patterns (CAPEC)

  • CAPEC-26 Leveraging Race Conditions Likelihood: High · Severity: High
  • CAPEC-29 Leveraging Time-of-Check and Time-of-Use (TOCTOU) Race Conditions Likelihood: High · Severity: High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON