From: rick.macklem@gmail.com
To: linux-nfs@vger.kernel.org
Cc: Rick Macklem <rmacklem@uoguelph.ca>
Subject: [PATCH v1 05/17] Add a check for both POSIX and NFSv4 ACLs being set
Date: Tue, 30 Dec 2025 18:21:07 -0800 [thread overview]
Message-ID: <20251231022119.1714-6-rick.macklem@gmail.com> (raw)
In-Reply-To: <20251231022119.1714-1-rick.macklem@gmail.com>
From: Rick Macklem <rmacklem@uoguelph.ca>
Check that both POSIX and NFSv4 ACLs are not being set by
the same SETATTR.
While here, fix posix_acl_release() for a couple of error cases
by adding a new out_err label, so the POSIX ACLs are released
before returning status. Note that posix_acl_release() checks
for a NULL argument and just returns for that case.
Signed-off-by: Rick Macklem <rmacklem@uoguelph.ca>
---
fs/nfsd/nfs4proc.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index b92477c87db1..71e9749375c1 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1215,7 +1215,7 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
&cstate->current_fh, &setattr->sa_stateid,
flags, NULL, &st);
if (status)
- return status;
+ goto out_err;
}
if (deleg_attrs) {
@@ -1233,17 +1233,24 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (st)
nfs4_put_stid(st);
if (status)
- return status;
+ goto out_err;
err = fh_want_write(&cstate->current_fh);
- if (err)
- return nfserrno(err);
+ if (err) {
+ status = nfserrno(err);
+ goto out_err;
+ }
status = nfs_ok;
status = check_attr_support(cstate, setattr->sa_bmval, nfsd_attrmask);
if (status)
goto out;
+ if (setattr->sa_acl && (setattr->sa_dpacl || setattr->sa_pacl)) {
+ status = nfserr_inval;
+ goto out;
+ }
+
inode = cstate->current_fh.fh_dentry->d_inode;
status = nfsd4_acl_to_attr(S_ISDIR(inode->i_mode) ? NF4DIR : NF4REG,
setattr->sa_acl, &attrs);
@@ -1262,12 +1269,11 @@ nfsd4_setattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
if (!status)
status = nfserrno(attrs.na_aclerr);
out:
- if (setattr->sa_dpacl != NULL)
- posix_acl_release(setattr->sa_dpacl);
- if (setattr->sa_pacl != NULL)
- posix_acl_release(setattr->sa_pacl);
nfsd_attrs_free(&attrs);
fh_drop_write(&cstate->current_fh);
+out_err:
+ posix_acl_release(setattr->sa_dpacl);
+ posix_acl_release(setattr->sa_pacl);
return status;
}
--
2.49.0
next prev parent reply other threads:[~2025-12-31 2:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-31 2:21 [PATCH v1 00/17] Add NFSv4.2 POSIX ACL support rick.macklem
2025-12-31 2:21 ` [PATCH v1 01/17] Add definitions for the POSIX draft ACL attributes rick.macklem
2025-12-31 2:21 ` [PATCH v1 02/17] Add a new function to acquire the POSIX draft ACLs rick.macklem
2025-12-31 2:21 ` [PATCH v1 03/17] Add a function to set POSIX ACLs rick.macklem
2025-12-31 2:21 ` [PATCH v1 04/17] Add support for encoding/decoding POSIX draft ACLs rick.macklem
2025-12-31 2:21 ` rick.macklem [this message]
2025-12-31 2:21 ` [PATCH v1 06/17] Add na_dpaclerr and na_paclerr for file creation rick.macklem
2025-12-31 2:21 ` [PATCH v1 07/17] Add support for POSIX draft ACLs " rick.macklem
2025-12-31 2:21 ` [PATCH v1 08/17] Add the arguments for decoding of POSIX ACLs rick.macklem
2025-12-31 2:21 ` [PATCH v1 09/17] Fix a couple of bugs in POSIX ACL decoding rick.macklem
2025-12-31 2:21 ` [PATCH v1 10/17] Improve correctness for the ACL_TRUEFORM attribute rick.macklem
2025-12-31 2:21 ` [PATCH v1 11/17] Make sort_pacl_range() global rick.macklem
2025-12-31 2:21 ` [PATCH v1 12/17] Call sort_pacl_range() for decoded POSIX draft ACLs rick.macklem
2025-12-31 2:21 ` [PATCH v1 13/17] Fix handling of POSIX ACLs with zero ACEs rick.macklem
2025-12-31 2:21 ` [PATCH v1 14/17] Fix handling of zero length ACLs for file creation rick.macklem
2025-12-31 2:21 ` [PATCH v1 15/17] Do not allow (N)VERIFY to check POSIX ACL attributes rick.macklem
2025-12-31 2:21 ` [PATCH v1 16/17] Set the POSIX ACL attributes supported rick.macklem
2025-12-31 2:21 ` [PATCH v1 17/17] Change a bunch of function prefixes to nfsd42_ rick.macklem
2025-12-31 2:47 ` [PATCH v1 00/17] Add NFSv4.2 POSIX ACL support Chuck Lever
2025-12-31 2:49 ` Rick Macklem
2025-12-31 2:57 ` Rick Macklem
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251231022119.1714-6-rick.macklem@gmail.com \
--to=rick.macklem@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=rmacklem@uoguelph.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox