FAILED: patch "[PATCH] nfsd: gate nfs2 setacl by argp->mask" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x a3a7e20ed66d3f04d37883c398da8a113b430769
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090350-onyx-repaying-474c@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a3a7e20ed66d3f04d37883c398da8a113b430769 Mon Sep 17 00:00:00 2001
From: Chuck Lever <[email protected]>
Date: Sat, 30 May 2026 16:58:16 -0400
Subject: [PATCH] nfsd: gate nfs2 setacl by argp->mask
The NFSACL v2 SETACL path shares the decoder convention used by its v3 sibling: nfsaclsvc_decode_setaclargs() fills in argp->acl_access only when NFS_ACL is set in the request mask and argp->acl_default only when NFS_DFACL is set, leaving the other pointer NULL because the argument buffer is zeroed up to pc_argzero before decode.
nfsacld_proc_setacl() then hands both pointers to set_posix_acl() unconditionally. set_posix_acl(idmap, dentry, type, NULL) is the VFS "remove this ACL type" operation, so an omitted arm is indistinguishable from an explicit request to delete that ACL. A SETACL carrying only NFS_ACL silently strips the directory's default ACL; mask=0 strips both.
This is the same defect just fixed in nfsd3_proc_setacl(); apply the same remedy. Gate each set_posix_acl() call on its mask bit and initialize error to 0 so that a request with neither bit set leaves the on-disk ACLs untouched and returns success. The out_drop_lock path and the unconditional posix_acl_release() in nfsaclsvc_release_setacl() already tolerate the skipped arms.
fs/nfsd/nfs2acl.c +13 -8
@@ -115,14 +115,19 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)inode_lock (inode); - error =set_posix_acl (&nop_mnt_idmap, fh->fh_dentry,ACL_TYPE_ACCESS , - argp->acl_access); -if (error) - goto out_drop_lock; - error =set_posix_acl (&nop_mnt_idmap, fh->fh_dentry,ACL_TYPE_DEFAULT , - argp->acl_default); -if (error) - goto out_drop_lock; + error =0 ; +if (argp->mask &NFS_ACL ) { + error =set_posix_acl (&nop_mnt_idmap, fh->fh_dentry, +ACL_TYPE_ACCESS , argp->acl_access); +if (error) + goto out_drop_lock; + } +if (argp->mask &NFS_DFACL ) { + error =set_posix_acl (&nop_mnt_idmap, fh->fh_dentry, +ACL_TYPE_DEFAULT , argp->acl_default); +if (error) + goto out_drop_lock; + }inode_unlock (inode);
Sasha Levin
maintainerPATCH 1/1 nfsd: gate nfs2 setacl by argp->mask
From: Chuck Lever <[email protected]>
[ Upstream commit a3a7e20ed66d3f04d37883c398da8a113b430769 ]
The NFSACL v2 SETACL path shares the decoder convention used by its v3 sibling: nfsaclsvc_decode_setaclargs() fills in argp->acl_access only when NFS_ACL is set in the request mask and argp->acl_default only when NFS_DFACL is set, leaving the other pointer NULL because the argument buffer is zeroed up to pc_argzero before decode.
nfsacld_proc_setacl() then hands both pointers to set_posix_acl() unconditionally. set_posix_acl(idmap, dentry, type, NULL) is the VFS "remove this ACL type" operation, so an omitted arm is indistinguishable from an explicit request to delete that ACL. A SETACL carrying only NFS_ACL silently strips the directory's default ACL; mask=0 strips both.
This is the same defect just fixed in nfsd3_proc_setacl(); apply the same remedy. Gate each set_posix_acl() call on its mask bit and initialize error to 0 so that a request with neither bit set leaves the on-disk ACLs untouched and returns success. The out_drop_lock path and the unconditional posix_acl_release() in nfsaclsvc_release_setacl() already tolerate the skipped arms.
--- fs/nfsd/nfs2acl.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
fs/nfsd/nfs2acl.c +13 -8
@@ -115,14 +115,19 @@ static __be32 nfsacld_proc_setacl(struct svc_rqst *rqstp)inode_lock (inode); - error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_ACCESS , - argp->acl_access); -if (error) - goto out_drop_lock; - error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_DEFAULT , - argp->acl_default); -if (error) - goto out_drop_lock; + error =0 ; +if (argp->mask &NFS_ACL ) { + error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_ACCESS , + argp->acl_access); +if (error) + goto out_drop_lock; + } +if (argp->mask &NFS_DFACL ) { + error =set_posix_acl (&init_user_ns, inode,ACL_TYPE_DEFAULT , + argp->acl_default); +if (error) + goto out_drop_lock; + }inode_unlock (inode);
Signature · 1 line
2.53.0