Skip to content

Commit 6d7cb54

Browse files
namjaejeonsmfrench
authored andcommitted
ksmbd: fix memleak in session setup
If client send session setup request with unknown NTLMSSP message type, session that does not included channel can be created. It will cause session memleak. because ksmbd_sessions_deregister() does not destroy session if channel is not included. This patch return error response if client send the request unknown NTLMSSP message type. Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-20593 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 1ae78a1 commit 6d7cb54

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/ksmbd/smb2pdu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1766,6 +1766,10 @@ int smb2_sess_setup(struct ksmbd_work *work)
17661766
}
17671767
kfree(sess->Preauth_HashValue);
17681768
sess->Preauth_HashValue = NULL;
1769+
} else {
1770+
pr_info_ratelimited("Unknown NTLMSSP message type : 0x%x\n",
1771+
le32_to_cpu(negblob->MessageType));
1772+
rc = -EINVAL;
17691773
}
17701774
} else {
17711775
/* TODO: need one more negotiation */

0 commit comments

Comments
 (0)