cifs: modefromsids must add an ACE for authenticated users
authorRonnie Sahlberg <lsahlber@redhat.com>
Sun, 13 Feb 2022 22:40:52 +0000 (08:40 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 8 Mar 2022 18:12:30 +0000 (19:12 +0100)
commit54e7951a1988ea710eabe7a1ea5f11010906f0e1
tree01fee29e201555346729ac77d799e51a7cf6cd86
parent18a9d6b18c2b433621fec7341f476689e09ecd34
cifs: modefromsids must add an ACE for authenticated users

[ Upstream commit 0c6f4ebf8835d01866eb686d47578cde80097981 ]

When we create a file with modefromsids we set an ACL that
has one ACE for the magic modefromsid as well as a second ACE that
grants full access to all authenticated users.

When later we chante the mode on the file we strip away this, and other,
ACE for authenticated users in set_chmod_dacl() and then just add back/update
the modefromsid ACE.
Thus leaving the file with a single ACE that is for the mode and no ACE
to grant any user any rights to access the file.
Fix this by always adding back also the modefromsid ACE so that we do not
drop the rights to access the file.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/cifs/cifsacl.c