CVE-2025-22037: ksmbd: fix null pointer dereference in alloc_preauth_hash()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix null pointer dereference in alloc_preauth_hash()
The Client send malformed smb2 negotiate request. ksmbd return error response. Subsequently, the client can send smb2 session setup even thought conn->preauth_info is not allocated.
This patch add KSMBD_SESS_NEED_SETUP status of connection to ignore session setup request if smb2 negotiate phase is not complete.
The Linux kernel CVE team has assigned CVE-2025-22037 to this issue.
Affected and fixed versions
===========================
Fixed in 6.12.23 with commit ca8bed31edf728a662ef9d6f39f50e7a7dc2b5ad Fixed in 6.13.11 with commit 8f216b33a5e1b3489c073b1ea1b3d7cb63c8dc4d Fixed in 6.14.2 with commit b8eb243e670ecf30e91524dd12f7260dac07d335 Fixed in 6.15-rc1 with commit c8b5b7c5da7d0c31c9b7190b4a7bba5281fc4780
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-22037
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/connection.h
fs/smb/server/mgmt/user_session.c
fs/smb/server/smb2pdu.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/ca8bed31edf728a662ef9d6f39f50e7a7dc2b5ad https://git.kernel.org/stable/c/8f216b33a5e1b3489c073b1ea1b3d7cb63c8dc4d https://git.kernel.org/stable/c/b8eb243e670ecf30e91524dd12f7260dac07d335 https://git.kernel.org/stable/c/c8b5b7c5da7d0c31c9b7190b4a7bba5281fc4780