Skip to contentSkip to conversation

ksmbd: fix use-after-free in session logoff

PATCH Superseded Nazar Kalashnikov 1 participant 1 message Nov 27, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ksmbd: fix use-after-free in session logoff

From: Sean Heelan <[email protected]>

commit 2fc9feff45d92a92cd5f96487655d5be23fb7e2b upstream.

The sess->user object can currently be in use by another thread, for example if another connection has sent a session setup request to bind to the session being free'd. The handler for that connection could be in the smb2_sess_setup function which makes use of sess->user.

---
v2: Fix duplicate From: header
Backport fix for CVE-2025-37899

 fs/smb/server/smb2pdu.c | 4 ----
 1 file changed, 4 deletions(-)
fs/smb/server/smb2pdu.c +0 -4
index d2dca5d2f17c..f72ef3fe4968 100644
@@ -2252,10 +2252,6 @@ int smb2_session_logoff(struct ksmbd_work *work)
 	sess->state = SMB2_SESSION_EXPIRED;
 	up_write(&conn->session_lock);
 
-	if (sess->user) {
-		ksmbd_free_user(sess->user);
-		sess->user = NULL;
-	}
 	ksmbd_all_conn_set_status(sess_id, KSMBD_SESS_NEED_NEGOTIATE);
 
 	rsp->StructureSize = cpu_to_le16(4);
Signature · 1 line
2.39.2