Skip to content

Commit

Permalink
ksmbd: fix memleak in get_file_stream_info()
Browse files Browse the repository at this point in the history
commit 178ca6f upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
namjaejeon authored and gregkh committed Dec 1, 2021
1 parent 522cd5c commit 11e6598
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/ksmbd/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -4489,8 +4489,10 @@ static void get_file_stream_info(struct ksmbd_work *work,
":%s", &stream_name[XATTR_NAME_STREAM_LEN]);

next = sizeof(struct smb2_file_stream_info) + streamlen * 2;
if (next > buf_free_len)
if (next > buf_free_len) {
kfree(stream_buf);
break;
}

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

0 comments on commit 11e6598

Please sign in to comment.