Skip to content

Commit 7d7c0c5

Browse files
namjaejeongregkh
authored andcommitted
ksmbd: fix Preauh_HashValue race condition
commit 44a3059 upstream. If client send multiple session setup requests to ksmbd, Preauh_HashValue race condition could happen. There is no need to free sess->Preauh_HashValue at session setup phase. It can be freed together with session at connection termination phase. Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-27661 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 015ef16 commit 7d7c0c5

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
@@ -1847,8 +1847,6 @@ int smb2_sess_setup(struct ksmbd_work *work)
18471847
ksmbd_conn_set_good(conn);
18481848
sess->state = SMB2_SESSION_VALID;
18491849
}
1850-
kfree(sess->Preauth_HashValue);
1851-
sess->Preauth_HashValue = NULL;
18521850
} else if (conn->preferred_auth_mech == KSMBD_AUTH_NTLMSSP) {
18531851
if (negblob->MessageType == NtLmNegotiate) {
18541852
rc = ntlm_negotiate(work, negblob, negblob_len, rsp);
@@ -1875,8 +1873,6 @@ int smb2_sess_setup(struct ksmbd_work *work)
18751873
kfree(preauth_sess);
18761874
}
18771875
}
1878-
kfree(sess->Preauth_HashValue);
1879-
sess->Preauth_HashValue = NULL;
18801876
} else {
18811877
pr_info_ratelimited("Unknown NTLMSSP message type : 0x%x\n",
18821878
le32_to_cpu(negblob->MessageType));

0 commit comments

Comments
 (0)