CVE-2025-68786: ksmbd: skip lock-range check on equal size to avoid size==0 underflow
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: skip lock-range check on equal size to avoid size==0 underflow
When size equals the current i_size (including 0), the code used to call check_lock_range(filp, i_size, size - 1, WRITE), which computes size - 1 and can underflow for size==0. Skip the equal case.
The Linux kernel CVE team has assigned CVE-2025-68786 to this issue.
Affected and fixed versions
===========================
Fixed in 6.1.160 with commit 52fcbb92e0d3acfd1448b2a43b6595d540da5295 Fixed in 6.6.120 with commit da29cd197246c85c0473259f1cad897d9d28faea Fixed in 6.12.64 with commit a6f4cfa3783804336491e0edcb250c25f9b59d33 Fixed in 6.18.3 with commit 571204e4758a528fbd67330bd4b0dfbdafb33dd8 Fixed in 6.19-rc1 with commit 5d510ac31626ed157d2182149559430350cf2104
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2025-68786
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/smb/server/vfs.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/52fcbb92e0d3acfd1448b2a43b6595d540da5295 https://git.kernel.org/stable/c/da29cd197246c85c0473259f1cad897d9d28faea https://git.kernel.org/stable/c/a6f4cfa3783804336491e0edcb250c25f9b59d33 https://git.kernel.org/stable/c/571204e4758a528fbd67330bd4b0dfbdafb33dd8 https://git.kernel.org/stable/c/5d510ac31626ed157d2182149559430350cf2104