Skip to contentSkip to conversation

CVE-2026-99539: ksmbd: fix session reference leak on compounded SESSION_SETUP

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Nov 19

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

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

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

ksmbd: fix session reference leak on compounded SESSION_SETUP

A compound request can place SESSION_SETUP after another command. That earlier command leaves a reference to its session in work->sess. smb2_sess_setup() then overwrites work->sess with the session it looks up or creates, and the dispatcher later puts work->sess only once. The inherited reference is never dropped. That leaks the session, together with its setup connection and socket, and every repeat of the compound leaks another.

unreferenced object (size 512):

    __kmalloc_cache_noprof+0x32c/0x3a0
    ksmbd_smb2_session_create+0xf6/0x9c0 [ksmbd]
    smb2_sess_setup+0xda4/0x6280 [ksmbd]
    handle_ksmbd_work+0x88c/0x1cb0 [ksmbd]

Save the inherited session on entry. After the request has been processed, release it once, but only when smb2_sess_setup() has replaced work->sess with its own session or cleared it. Do this after ksmbd_conn_unlock() so the put does not run under srv_mutex. An error path may instead leave the inherited session in work->sess. Keep it there, so the dispatcher still puts it and the error response is still signed or encrypted with it as before.

The Linux kernel CVE team has assigned CVE-2026-99539 to this issue.

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

	Issue introduced in 6.12 with commit 7aa8804c0b67b3cb263a472d17f2cb50d7f1a930 and fixed in 6.12.117 with commit b2d710b12e86fd4cf02be090651fa6ea8683fc29
	Issue introduced in 6.12 with commit 7aa8804c0b67b3cb263a472d17f2cb50d7f1a930 and fixed in 6.18.61 with commit 38cddb9f7c9102f23652d198748c658072cf0df5
	Issue introduced in 6.12 with commit 7aa8804c0b67b3cb263a472d17f2cb50d7f1a930 and fixed in 7.3.2 with commit db30f8f330fc73304edfe595dc5a6f5e17ba97f2
	Issue introduced in 6.12 with commit 7aa8804c0b67b3cb263a472d17f2cb50d7f1a930 and fixed in 7.4-rc1 with commit 03bd8f5279e490e15e0c0f0fa388ffbd2fbacd65
	Issue introduced in 5.15.171 with commit 0f62358ce85b2d4c949ef1b648be01b29cec667a
	Issue introduced in 6.1.114 with commit a9839c37fd813b432988f58a9d9dd59253d3eb2c
	Issue introduced in 6.6.58 with commit 5511999e9615e4318e9142d23b29bd1597befc08
	Issue introduced in 6.11.5 with commit ee371898b53a9b9b51c02d22a8c31bfb86d45f0d

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-2026-99539

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/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/b2d710b12e86fd4cf02be090651fa6ea8683fc29
	https://git.kernel.org/stable/c/38cddb9f7c9102f23652d198748c658072cf0df5
	https://git.kernel.org/stable/c/db30f8f330fc73304edfe595dc5a6f5e17ba97f2
	https://git.kernel.org/stable/c/03bd8f5279e490e15e0c0f0fa388ffbd2fbacd65