Skip to content

Commit b85fa41

Browse files
smfrenchgregkh
authored andcommitted
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>
1 parent 89d2300 commit b85fa41

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

fs/cifs/smb2pdu.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,12 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
564564
}
565565

566566
if (rsplen != sizeof(struct validate_negotiate_info_rsp)) {
567-
cifs_dbg(VFS, "invalid size of protocol negotiate response\n");
568-
return -EIO;
567+
cifs_dbg(VFS, "invalid protocol negotiate response size: %d\n",
568+
rsplen);
569+
570+
/* relax check since Mac returns max bufsize allowed on ioctl */
571+
if (rsplen > CIFSMaxBufSize)
572+
return -EIO;
569573
}
570574

571575
/* check validate negotiate info response matches what we got earlier */
@@ -1518,8 +1522,12 @@ SMB2_ioctl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
15181522
* than one credit. Windows typically sets this smaller, but for some
15191523
* ioctls it may be useful to allow server to send more. No point
15201524
* limiting what the server can send as long as fits in one credit
1525+
* Unfortunately - we can not handle more than CIFS_MAX_MSG_SIZE
1526+
* (by default, note that it can be overridden to make max larger)
1527+
* in responses (except for read responses which can be bigger.
1528+
* We may want to bump this limit up
15211529
*/
1522-
req->MaxOutputResponse = cpu_to_le32(0xFF00); /* < 64K uses 1 credit */
1530+
req->MaxOutputResponse = cpu_to_le32(CIFSMaxBufSize);
15231531

15241532
if (is_fsctl)
15251533
req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);

0 commit comments

Comments
 (0)