Skip to content

Commit

Permalink
ksmbd: fix use-after-free in session logoff
Browse files Browse the repository at this point in the history
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.

Cc: stable@vger.kernel.org
Signed-off-by: Sean Heelan <seanheelan@gmail.com>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Sean Heelan authored and Steve French committed Apr 25, 2025
1 parent e86e913 commit 2fc9fef
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fs/smb/server/smb2pdu.c
Original file line number Diff line number Diff line change
@@ -2249,10 +2249,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_SETUP);

rsp->StructureSize = cpu_to_le16(4);

0 comments on commit 2fc9fef

Please sign in to comment.