]> git.baikalelectronics.ru Git - kernel.git/commitdiff
cifs: create sd context must be a multiple of 8
authorShyam Prasad N <sprasad@microsoft.com>
Wed, 4 Aug 2021 18:37:22 +0000 (18:37 +0000)
committerSteve French <stfrench@microsoft.com>
Thu, 5 Aug 2021 17:48:42 +0000 (12:48 -0500)
We used to follow the rule earlier that the create SD context
always be a multiple of 8. However, with the change:
cifs: refactor create_sd_buf() and and avoid corrupting the buffer
...we recompute the length, and we failed that rule.
Fixing that with this change.

Cc: <stable@vger.kernel.org> # v5.10+
Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c

index 781d14e5f2afe282ef0195ce6c4c7efbff9695bd..b6d2e3591927825014a4fb1b6530f2e34dbd3285 100644 (file)
@@ -2426,7 +2426,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
        memcpy(aclptr, &acl, sizeof(struct cifs_acl));
 
        buf->ccontext.DataLength = cpu_to_le32(ptr - (__u8 *)&buf->sd);
-       *len = ptr - (__u8 *)buf;
+       *len = roundup(ptr - (__u8 *)buf, 8);
 
        return buf;
 }