CVE-2025-22041: ksmbd: fix use-after-free in ksmbd_sessions_deregister()
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ksmbd: fix use-after-free in ksmbd_sessions_deregister()
In multichannel mode, UAF issue can occur in session_deregister when the second channel sets up a session through the connection of the first channel. session that is freed through the global session table can be accessed again through ->sessions of connection.
The Linux kernel CVE team has assigned CVE-2025-22041 to this issue.
Affected and fixed versions
===========================
Fixed in 6.1.134 with commit f0eb3f575138b816da74697bd506682574742fcd Fixed in 6.6.87 with commit a8a8ae303a8395cbac270b5b404d85df6ec788f8 Fixed in 6.12.23 with commit ca042cc0e4f9e0d2c8f86dd67e4b22f30a516a9b Fixed in 6.13.11 with commit 8ed0e9d2f410f63525afb8351181eea36c80bcf1 Fixed in 6.14.2 with commit 33cc29e221df7a3085ae413e8c26c4e81a151153 Fixed in 6.15-rc1 with commit 15a9605f8d69dc85005b1a00c31a050b8625e1aa
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-22041
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/mgmt/user_session.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/f0eb3f575138b816da74697bd506682574742fcd https://git.kernel.org/stable/c/a8a8ae303a8395cbac270b5b404d85df6ec788f8 https://git.kernel.org/stable/c/ca042cc0e4f9e0d2c8f86dd67e4b22f30a516a9b https://git.kernel.org/stable/c/8ed0e9d2f410f63525afb8351181eea36c80bcf1 https://git.kernel.org/stable/c/33cc29e221df7a3085ae413e8c26c4e81a151153 https://git.kernel.org/stable/c/15a9605f8d69dc85005b1a00c31a050b8625e1aa