Skip to content

Commit 70ad645

Browse files
SeanHeelangregkh
authored andcommitted
ksmbd: fix use-after-free in session logoff
commit 2fc9fef 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. Signed-off-by: Sean Heelan <seanheelan@gmail.com> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Nazar Kalashnikov <sivartiwe@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3a13454 commit 70ad645

1 file changed

Lines changed: 0 additions & 4 deletions

File tree

fs/smb/server/smb2pdu.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,10 +2255,6 @@ int smb2_session_logoff(struct ksmbd_work *work)
22552255
sess->state = SMB2_SESSION_EXPIRED;
22562256
up_write(&conn->session_lock);
22572257

2258-
if (sess->user) {
2259-
ksmbd_free_user(sess->user);
2260-
sess->user = NULL;
2261-
}
22622258
ksmbd_all_conn_set_status(sess_id, KSMBD_SESS_NEED_SETUP);
22632259

22642260
rsp->StructureSize = cpu_to_le16(4);

0 commit comments

Comments
 (0)