]> git.baikalelectronics.ru Git - kernel.git/commitdiff
smb3: fix incorrect number of credits when ioctl MaxOutputResponse > 64K
authorSteve French <stfrench@microsoft.com>
Wed, 3 Jun 2020 06:33:58 +0000 (01:33 -0500)
committerSteve French <stfrench@microsoft.com>
Thu, 4 Jun 2020 06:13:41 +0000 (01:13 -0500)
We were not checking to see if ioctl requests asked for more than
64K (ie when CIFSMaxBufSize was > 64K) so when setting larger
CIFSMaxBufSize then ioctls would fail with invalid parameter errors.
When requests ask for more than 64K in MaxOutputResponse then we
need to ask for more than 1 credit.

Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
fs/cifs/smb2pdu.c

index 06463f386a60c0aa7fc7879dac80be654af07404..12de0af12f75ee6e6f45ac7fac2f416f3a89cce5 100644 (file)
@@ -2938,7 +2938,7 @@ SMB2_ioctl_init(struct cifs_tcon *tcon, struct smb_rqst *rqst,
         * response size smaller.
         */
        req->MaxOutputResponse = cpu_to_le32(max_response_size);
-
+       req->sync_hdr.CreditCharge = cpu_to_le16(DIV_ROUND_UP(max_response_size, SMB2_MAX_BUFFER_SIZE));
        if (is_fsctl)
                req->Flags = cpu_to_le32(SMB2_0_IOCTL_IS_FSCTL);
        else