aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorSteve French <smfrench@gmail.com>2017-05-03 22:12:20 -0400
committerSteve French <smfrench@gmail.com>2017-05-03 22:23:48 -0400
commit7db0a6efdc3e990cdfd4b24820d010e9eb7890ad (patch)
treecf9f0f71b301cc950949dfff20bdad9bebe0ed97 /fs/cifs/smb2pdu.c
parentd8a6e505d6bba2250852fbc1c1c86fe68aaf9af3 (diff)
SMB3: Work around mount failure when using SMB3 dialect to Macs
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> CC: Stable <stable@vger.kernel.org>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-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 02da648041fc..0fd63f0bc440 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -632,8 +632,12 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
632 } 632 }
633 633
634 if (rsplen != sizeof(struct validate_negotiate_info_rsp)) { 634 if (rsplen != sizeof(struct validate_negotiate_info_rsp)) {
635 cifs_dbg(VFS, "invalid size of protocol negotiate response\n"); 635 cifs_dbg(VFS, "invalid protocol negotiate response size: %d\n",
636 return -EIO; 636 rsplen);
637
638 /* relax check since Mac returns max bufsize allowed on ioctl */
639 if (rsplen > CIFSMaxBufSize)
640 return -EIO;
637 } 641 }
638 642
639 /* check validate negotiate info response matches what we got earlier */ 643 /* check validate negotiate info response matches what we got earlier */
@@ -1853,8 +1857,12 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
1853 * than one credit. Windows typically sets this smaller, but for some 1857 * than one credit. Windows typically sets this smaller, but for some
1854 * ioctls it may be useful to allow server to send more. No point 1858 * ioctls it may be useful to allow server to send more. No point
1855 * limiting what the server can send as long as fits in one credit 1859 * limiting what the server can send as long as fits in one credit
1860 * Unfortunately - we can not handle more than CIFS_MAX_MSG_SIZE
1861 * (by default, note that it can be overridden to make max larger)
1862 * in responses (except for read responses which can be bigger.
1863 * We may want to bump this limit up
1856 */ 1864 */
1857 req->MaxOutputResponse = cpu_to_le32(0xFF00); /* < 64K uses 1 credit */ 1865 req->MaxOutputResponse = cpu_to_le32(CIFSMaxBufSize);
1858 1866
1859 if (is_fsctl) 1867 if (is_fsctl)
1860 req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL); 1868 req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);