diff options
| author | Ian Bridges <icb@fastmail.org> | 2026-10-26 00:34:22 -0500 |
|---|---|---|
| committer | Namjae Jeon <linkinjeon@kernel.org> | 2026-10-26 19:15:35 +0900 |
| commit | f728cfee6929057087c303d07d7a6a7c61196b48 (patch) | |
| tree | 5a423e9089d58cbea5774fcd279693c240315537 /scripts/Makefile.thinlto | |
| parent | 7193241a49c958782ba4b8df06da3734d1e317d2 (diff) | |
| download | linux-f728cfee6929057087c303d07d7a6a7c61196b48.tar.gz linux-f728cfee6929057087c303d07d7a6a7c61196b48.zip | |
ksmbd: fix app-instance non-durable supersede session UAF
ksmbd_close_fd_app_instance_id() supersedes a prior open that has the
same AppInstanceId. It reaches that open's session through opinfo->sess.
This pointer is not refcounted.
Session teardown detaches durable handles before it frees the session.
It does not detach a non-durable open. That open still points at the
session through opinfo->sess after the session is freed. Another session
can supersede the open at the same time. The supersede then takes a
write lock through the stale pointer, in the freed session's file table.
BUG: KASAN: slab-use-after-free in _raw_write_lock+0x71/0xd0
Call Trace:
_raw_write_lock+0x71/0xd0
ksmbd_close_fd_app_instance_id+0xd9/0x670 [ksmbd]
smb2_open+0x3e10/0xd910 [ksmbd]
Freed by task 212:
ksmbd_session_destroy+0x38d/0x480 [ksmbd]
Fix this by looking the session up by opinfo->session_id. The lookup
returns a reference, as smb2_break_collect_channels() does. Recheck that
opinfo->sess still points at it before using it.
Do the lookup without m_lock held. destroy_previous_session() takes
m_lock under the session table lock, and taking them in the other order
here would deadlock.
Fixes: 16c30649709d ("ksmbd: handle durable v2 app instance id")
Cc: stable@vger.kernel.org # e0386cd6498b: ksmbd: validate AppInstanceId takeover target
Signed-off-by: Ian Bridges <icb@fastmail.org>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
