cifs: refactor create_sd_buf() and and avoid corrupting the buffer
authorRonnie Sahlberg <lsahlber@redhat.com>
Mon, 30 Nov 2020 01:29:20 +0000 (11:29 +1000)
committerSteve French <stfrench@microsoft.com>
Thu, 3 Dec 2020 23:12:14 +0000 (17:12 -0600)
commitea64370bcae126a88cd26a16f1abcc23ab2b9a55
tree45513cee94669dca19d662a2c35aa410ef9924ac
parent59463eb88829f646aed13283fd84d02a475334fe
cifs: refactor create_sd_buf() and and avoid corrupting the buffer

When mounting with "idsfromsid" mount option, Azure
corrupted the owner SIDs due to excessive padding
caused by placing the owner fields at the end of the
security descriptor on create.  Placing owners at the
front of the security descriptor (rather than the end)
is also safer, as the number of ACEs (that follow it)
are variable.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Suggested-by: Rohith Surabattula <rohiths@microsoft.com>
CC: Stable <stable@vger.kernel.org> # v5.8
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/smb2pdu.c
fs/cifs/smb2pdu.h