CVE-2025-21994: ksmbd: fix incorrect validation for num_aces field of smb_acl
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix incorrect validation for num_aces field of smb_acl
parse_dcal() validate num_aces to allocate posix_ace_state_array.
if (num_aces > ULONG_MAX / sizeof(struct smb_ace *))
It is an incorrect validation that we can create an array of size ULONG_MAX. smb_acl has ->size field to calculate actual number of aces in request buffer size. Use this to check invalid num_aces.
The Linux kernel CVE team has assigned CVE-2025-21994 to this issue.
Affected and fixed versions
===========================
Fixed in 6.1.132 with commit 9c4e202abff45f8eac17989e549fc7a75095f675 Fixed in 6.6.85 with commit d0f87370622a853b57e851f7d5a5452b72300f19 Fixed in 6.12.21 with commit a4cb17797a5d241f1e509cb5b46ed95a80c2f5fd Fixed in 6.13.9 with commit f6a6721802ac2f12f4c1bbe839a4c229b61866f2 Fixed in 6.14 with commit 1b8b67f3c5e5169535e26efedd3e422172e2db64
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-21994
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/smbacl.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/9c4e202abff45f8eac17989e549fc7a75095f675 https://git.kernel.org/stable/c/d0f87370622a853b57e851f7d5a5452b72300f19 https://git.kernel.org/stable/c/a4cb17797a5d241f1e509cb5b46ed95a80c2f5fd https://git.kernel.org/stable/c/f6a6721802ac2f12f4c1bbe839a4c229b61866f2 https://git.kernel.org/stable/c/1b8b67f3c5e5169535e26efedd3e422172e2db64