summaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2017-10-20 14:49:38 +0200
committerSteve French <smfrench@gmail.com>2017-10-25 13:04:25 -0500
commita2d9daad1d2dfbd307ab158044d1c323d7babbde (patch)
tree930b847cdec5700e372ad6badd6b58f70160a3e8 /fs/cifs
parentfe83bebc05228e838ed5cbbc62712ab50dd40e18 (diff)
downloadlinux-a2d9daad1d2dfbd307ab158044d1c323d7babbde.tar.bz2
SMB: fix validate negotiate info uninitialised memory use
An undersize validate negotiate info server response causes the client to use uninitialised memory for struct validate_negotiate_info_rsp comparisons of Dialect, SecurityMode and/or Capabilities members. Link: https://bugzilla.samba.org/show_bug.cgi?id=13092 Fixes: 7db0a6efdc3e ("SMB3: Work around mount failure when using SMB3 dialect to Macs") Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/smb2pdu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 6b03e2d45d8e..ba58af747b43 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -727,7 +727,8 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
rsplen);
/* relax check since Mac returns max bufsize allowed on ioctl */
- if (rsplen > CIFSMaxBufSize)
+ if ((rsplen > CIFSMaxBufSize)
+ || (rsplen < sizeof(struct validate_negotiate_info_rsp)))
goto err_rsp_free;
}