Skip to contentSkip to conversation

CVE-2025-22040: ksmbd: fix session use-after-free in multichannel connection

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Apr 16, 2025

lore
Share & tools
lore
#0 lore raw

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

ksmbd: fix session use-after-free in multichannel connection

There is a race condition between session setup and ksmbd_sessions_deregister. The session can be freed before the connection is added to channel list of session.
This patch check reference count of session before freeing it.

The Linux kernel CVE team has assigned CVE-2025-22040 to this issue.

Affected and fixed versions
===========================

	Fixed in 6.1.134 with commit 596407adb9af1ee75fe7c7529607783d31b66e7f
	Fixed in 6.6.87 with commit 3980770cb1470054e6400fd97668665975726737
	Fixed in 6.12.23 with commit 9069939d762138e232a6f79e3e1462682ed6a17d
	Fixed in 6.13.11 with commit 94c281721d4ed2d972232414b91d98a6f5bdb16b
	Fixed in 6.14.2 with commit 7dfbd4c43eed91dd2548a95236908025707a8dfd
	Fixed in 6.15-rc1 with commit fa4cdb8cbca7d6cb6aa13e4d8d83d1103f6345db

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-22040

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/auth.c
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/596407adb9af1ee75fe7c7529607783d31b66e7f
	https://git.kernel.org/stable/c/3980770cb1470054e6400fd97668665975726737
	https://git.kernel.org/stable/c/9069939d762138e232a6f79e3e1462682ed6a17d
	https://git.kernel.org/stable/c/94c281721d4ed2d972232414b91d98a6f5bdb16b
	https://git.kernel.org/stable/c/7dfbd4c43eed91dd2548a95236908025707a8dfd
	https://git.kernel.org/stable/c/fa4cdb8cbca7d6cb6aa13e4d8d83d1103f6345db