]> git.baikalelectronics.ru Git - kernel.git/commitdiff
smb3: when mounting with multichannel include it in requested capabilities
authorSteve French <stfrench@microsoft.com>
Fri, 7 May 2021 23:24:11 +0000 (18:24 -0500)
committerSteve French <stfrench@microsoft.com>
Sat, 8 May 2021 15:44:11 +0000 (10:44 -0500)
In the SMB3/SMB3.1.1 negotiate protocol request, we are supposed to
advertise CAP_MULTICHANNEL capability when establishing multiple
channels has been requested by the user doing the mount. See MS-SMB2
sections 2.2.3 and 3.2.5.2

Without setting it there is some risk that multichannel could fail
if the server interpreted the field strictly.

Reviewed-By: Tom Talpey <tom@talpey.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Cc: <stable@vger.kernel.org> # v5.8+
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c

index e36c2a8677836ad85c8aa34a76e89a7253e44ae5..a8bf431847730298c4da9f3a311d612337d1ee28 100644 (file)
@@ -841,6 +841,8 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
                req->SecurityMode = 0;
 
        req->Capabilities = cpu_to_le32(server->vals->req_capabilities);
+       if (ses->chan_max > 1)
+               req->Capabilities |= cpu_to_le32(SMB2_GLOBAL_CAP_MULTI_CHANNEL);
 
        /* ClientGUID must be zero for SMB2.02 dialect */
        if (server->vals->protocol_id == SMB20_PROT_ID)
@@ -1032,6 +1034,9 @@ int smb3_validate_negotiate(const unsigned int xid, struct cifs_tcon *tcon)
 
        pneg_inbuf->Capabilities =
                        cpu_to_le32(server->vals->req_capabilities);
+       if (tcon->ses->chan_max > 1)
+               pneg_inbuf->Capabilities |= cpu_to_le32(SMB2_GLOBAL_CAP_MULTI_CHANNEL);
+
        memcpy(pneg_inbuf->Guid, server->client_guid,
                                        SMB2_CLIENT_GUID_SIZE);