]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
ksmbd: lock the binding preauth session in smb3_preauth_hash_rsp
authorGil Portnoy <dddhkts1@gmail.com>
Mon, 13 Jul 2026 00:20:09 +0000 (09:20 +0900)
committerSteve French <stfrench@microsoft.com>
Thu, 16 Jul 2026 15:18:25 +0000 (10:18 -0500)
commit35754558f6c21d0fa0985dceb3387071a3348aff
treed2414da995c6ddb5a947ea2fd0a877895f68fd48
parentb10665730fbf6b5e45fe422badcbbc3f0df96ef5
ksmbd: lock the binding preauth session in smb3_preauth_hash_rsp

smb3_preauth_hash_rsp() computes the SMB3.1.1 preauth integrity hash on
the response path. For a binding SESSION_SETUP it looks up the
per-connection preauth_session and reads its Preauth_HashValue.

smb2_sess_setup() frees that preauth_session under ksmbd_conn_lock().
Two SMB2 requests on one connection can run concurrently, so an unlocked
lookup and hash can use a preauth_session after another worker frees it.

Take ksmbd_conn_lock() before selecting conn->binding and hold it across
the selected preauth hash lookup and update. This preserves the existing
hash selection while preventing the lookup-to-use lifetime race.

Fixes: 1c5daa2ea924 ("ksmbd: handle channel binding with a different user")
Signed-off-by: Gil Portnoy <dddhkts1@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/smb2pdu.c