mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
smb: client: validate change notify buffer before copy
commit4012abe8a7upstream. SMB2_change_notify called smb2_validate_iov() but ignored the return code, then kmemdup()ed using server provided OutputBufferOffset/Length. Check the return of smb2_validate_iov() and bail out on error. Discovered with help from the ZeroPath security tooling. Signed-off-by: Joshua Rogers <linux@joshua.hu> Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org> Cc: stable@vger.kernel.org Fixes:e3e9463414("smb3: improve SMB3 change notification support") Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
a557649f00
commit
3d82cb8465
@@ -4074,9 +4074,12 @@ replay_again:
|
|||||||
|
|
||||||
smb_rsp = (struct smb2_change_notify_rsp *)rsp_iov.iov_base;
|
smb_rsp = (struct smb2_change_notify_rsp *)rsp_iov.iov_base;
|
||||||
|
|
||||||
smb2_validate_iov(le16_to_cpu(smb_rsp->OutputBufferOffset),
|
rc = smb2_validate_iov(le16_to_cpu(smb_rsp->OutputBufferOffset),
|
||||||
le32_to_cpu(smb_rsp->OutputBufferLength), &rsp_iov,
|
le32_to_cpu(smb_rsp->OutputBufferLength),
|
||||||
|
&rsp_iov,
|
||||||
sizeof(struct file_notify_information));
|
sizeof(struct file_notify_information));
|
||||||
|
if (rc)
|
||||||
|
goto cnotify_exit;
|
||||||
|
|
||||||
*out_data = kmemdup((char *)smb_rsp + le16_to_cpu(smb_rsp->OutputBufferOffset),
|
*out_data = kmemdup((char *)smb_rsp + le16_to_cpu(smb_rsp->OutputBufferOffset),
|
||||||
le32_to_cpu(smb_rsp->OutputBufferLength), GFP_KERNEL);
|
le32_to_cpu(smb_rsp->OutputBufferLength), GFP_KERNEL);
|
||||||
|
|||||||
Reference in New Issue
Block a user