diff options
| author | Ian Bridges <icb@fastmail.org> | 2026-10-27 10:21:35 -0500 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2026-10-28 17:54:23 +0900 |
| commit | 03bd8f5279e490e15e0c0f0fa388ffbd2fbacd65 (patch) | |
| tree | 9bda80b940064c3d05a0d02217da59b4b91b1ecc /scripts/ipe | |
| parent | 2d5c7afbb1d19f51f76c0865b4cb2e4e8347ade6 (diff) | |
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.
Fixes: 7aa8804c0b67 ("ksmbd: fix user-after-free from session log off")
Cc: stable@vger.kernel.org
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'scripts/ipe')
0 files changed, 0 insertions, 0 deletions
