]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
NFSD: NFSv4 file creation neglects setting ACL
authorChuck Lever <chuck.lever@oracle.com>
Mon, 5 Jan 2026 20:36:25 +0000 (15:36 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Jan 2026 12:12:06 +0000 (13:12 +0100)
[ Upstream commit 913f7cf77bf14c13cfea70e89bcb6d0b22239562 ]

An NFSv4 client that sets an ACL with a named principal during file
creation retrieves the ACL afterwards, and finds that it is only a
default ACL (based on the mode bits) and not the ACL that was
requested during file creation. This violates RFC 8881 section
6.4.1.3: "the ACL attribute is set as given".

The issue occurs in nfsd_create_setattr(). On 6.1.y, the check to
determine whether nfsd_setattr() should be called is simply
"iap->ia_valid", which only accounts for iattr changes. When only
an ACL is present (and no iattr fields are set), nfsd_setattr() is
skipped and the POSIX ACL is never applied to the inode.

Subsequently, when the client retrieves the ACL, the server finds
no POSIX ACL on the inode and returns one generated from the file's
mode bits rather than returning the originally-specified ACL.

Reported-by: Aurelien Couderc <aurelien.couderc2002@gmail.com>
Fixes: c0cbe70742f4 ("NFSD: add posix ACLs to struct nfsd_attrs")
Cc: stable@vger.kernel.org
[ cel: Adjust nfsd_create_setattr() instead of nfsd_attrs_valid() ]
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/vfs.c

index 54be4cd9794a02948a5d911ad0860aec93c90052..7739a47356e75f8e88ab60b81dc1f2b4476950bb 100644 (file)
@@ -1335,7 +1335,7 @@ nfsd_create_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
         * Callers expect new file metadata to be committed even
         * if the attributes have not changed.
         */
-       if (iap->ia_valid)
+       if (iap->ia_valid || attrs->na_pacl || attrs->na_dpacl)
                status = nfsd_setattr(rqstp, resfhp, attrs, 0, (time64_t)0);
        else
                status = nfserrno(commit_metadata(resfhp));