aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2017-05-03 22:12:20 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-20 08:28:40 -0400
commit8dd4e3ff1bfb707c073e05df57ad0305a6ce7979 (patch)
tree55f33b4f1e3adb4e39d2a4a211905b7f58f1dabe /fs
parent2ac2ad9fb04537160a35af7fefe8560f968ac896 (diff)
SMB3: Work around mount failure when using SMB3 dialect to Macs
commit 7db0a6efdc3e990cdfd4b24820d010e9eb7890ad upstream. Macs send the maximum buffer size in response on ioctl to validate negotiate security information, which causes us to fail the mount as the response buffer is larger than the expected response. Changed ioctl response processing to allow for padding of validate negotiate ioctl response and limit the maximum response size to maximum buffer size. Signed-off-by: Steve French <steve.french@primarydata.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/smb2pdu.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 802185386851..7c1c6c39d582 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -569,8 +569,12 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
569 } 569 }
570 570
571 if (rsplen != sizeof(struct validate_negotiate_info_rsp)) { 571 if (rsplen != sizeof(struct validate_negotiate_info_rsp)) {
572 cifs_dbg(VFS, "invalid size of protocol negotiate response\n"); 572 cifs_dbg(VFS, "invalid protocol negotiate response size: %d\n",
573 return -EIO; 573 rsplen);
574
575 /* relax check since Mac returns max bufsize allowed on ioctl */
576 if (rsplen > CIFSMaxBufSize)
577 return -EIO;
574 } 578 }
575 579
576 /* check validate negotiate info response matches what we got earlier */ 580 /* check validate negotiate info response matches what we got earlier */
@@ -1670,8 +1674,12 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1670 * than one credit. Windows typically sets this smaller, but for some 1674 * than one credit. Windows typically sets this smaller, but for some
1671 * ioctls it may be useful to allow server to send more. No point 1675 * ioctls it may be useful to allow server to send more. No point
1672 * limiting what the server can send as long as fits in one credit 1676 * limiting what the server can send as long as fits in one credit
1677 * Unfortunately - we can not handle more than CIFS_MAX_MSG_SIZE
1678 * (by default, note that it can be overridden to make max larger)
1679 * in responses (except for read responses which can be bigger.
1680 * We may want to bump this limit up
1673 */ 1681 */
1674 req->MaxOutputResponse = cpu_to_le32(0xFF00); /* < 64K uses 1 credit */ 1682 req->MaxOutputResponse = cpu_to_le32(CIFSMaxBufSize);
1675 1683
1676 if (is_fsctl) 1684 if (is_fsctl)
1677 req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); 1685 req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);