summaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
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 20:04:25 +0200
commita2d9daad1d2dfbd307ab158044d1c323d7babbde (patch)
tree930b847cdec5700e372ad6badd6b58f70160a3e8 /fs/cifs/smb2pdu.c
parentSMB: fix leak of validate negotiate info response buffer (diff)
downloadlinux-a2d9daad1d2dfbd307ab158044d1c323d7babbde.tar.xz
linux-a2d9daad1d2dfbd307ab158044d1c323d7babbde.zip
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 '')
-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;
}