Skip to content

Commit 178ca6f

Browse files
namjaejeonSteve French
authored andcommitted
ksmbd: fix memleak in get_file_stream_info()
Fix memleak in get_file_stream_info() Fixes: 34061d6 ("ksmbd: validate OutputBufferLength of QUERY_DIR, QUERY_INFO, IOCTL requests") Cc: stable@vger.kernel.org # v5.15 Reported-by: Coverity Scan <scan-admin@coverity.com> Acked-by: Hyunchul Lee <hyc.lee@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 1ec7215 commit 178ca6f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4498,8 +4498,10 @@ static void get_file_stream_info(struct ksmbd_work *work,
44984498
":%s", &stream_name[XATTR_NAME_STREAM_LEN]);
44994499

45004500
next = sizeof(struct smb2_file_stream_info) + streamlen * 2;
4501-
if (next > buf_free_len)
4501+
if (next > buf_free_len) {
4502+
kfree(stream_buf);
45024503
break;
4504+
}
45034505

45044506
file_info = (struct smb2_file_stream_info *)&rsp->Buffer[nbytes];
45054507
streamlen = smbConvertToUTF16((__le16 *)file_info->StreamName,

0 commit comments

Comments
 (0)