Skip to content

Commit aa7253c

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: fix memory leak in smb2_handle_negotiate
The allocated memory didn't free under an error path in smb2_handle_negotiate(). Fixes: e2f3448 ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17815 Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Reviewed-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent af7c39d commit aa7253c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,12 +1142,16 @@ int smb2_handle_negotiate(struct ksmbd_work *work)
11421142
status);
11431143
rsp->hdr.Status = status;
11441144
rc = -EINVAL;
1145+
kfree(conn->preauth_info);
1146+
conn->preauth_info = NULL;
11451147
goto err_out;
11461148
}
11471149

11481150
rc = init_smb3_11_server(conn);
11491151
if (rc < 0) {
11501152
rsp->hdr.Status = STATUS_INVALID_PARAMETER;
1153+
kfree(conn->preauth_info);
1154+
conn->preauth_info = NULL;
11511155
goto err_out;
11521156
}
11531157

0 commit comments

Comments
 (0)