From: Chuck Lever <cel@kernel.org>
To: NeilBrown <neil@brown.name>, Jeff Layton <jlayton@kernel.org>,
Olga Kornievskaia <okorniev@redhat.com>,
Dai Ngo <dai.ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH v1 2/2] nfs_common: Do not stream-encode an ACL with fewer than three entries
Date: Thu, 24 Sep 2026 17:22:46 -0400 [thread overview]
Message-ID: <20260924212246.114355-3-cel@kernel.org> (raw)
In-Reply-To: <20260924212246.114355-1-cel@kernel.org>
nfs_stream_encode_acl() reports at least four wire entries for any
ACL that has entries, because a three-entry ACL is sent as four
with a synthesized ACL_MASK. The entry encoder then walks
a_entries[] up to that count. For an ACL with one or two entries,
which posix_acl_from_xattr() and the filesystem on-disk parsers do
not reject, the walk reads past the end of the posix_acl
allocation and copies the bytes into the GETACL reply.
Report zero wire entries for an ACL with fewer than three, the
same as for an ACL with none.
Fixes: 8edc0648880a ("NFSD: Add an xdr_stream-based encoder for NFSv2/3 ACLs")
Signed-off-by: Chuck Lever <cel@kernel.org>
---
fs/nfs_common/nfsacl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/nfs_common/nfsacl.c b/fs/nfs_common/nfsacl.c
index 38bb2c294d7c..24ee7f622b18 100644
--- a/fs/nfs_common/nfsacl.c
+++ b/fs/nfs_common/nfsacl.c
@@ -157,7 +157,8 @@ bool nfs_stream_encode_acl(struct xdr_stream *xdr, struct inode *inode,
int typeflag)
{
const size_t elem_size = XDR_UNIT * 3;
- u32 entries = (acl && acl->a_count) ? max_t(int, acl->a_count, 4) : 0;
+ u32 entries = (acl && acl->a_count >= 3) ?
+ max_t(int, acl->a_count, 4) : 0;
struct nfsacl_encode_desc nfsacl_desc = {
.desc = {
.elem_size = elem_size,
--
2.55.0
prev parent reply other threads:[~2026-09-24 21:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-24 21:22 [PATCH v1 0/2] nfs_common: Encode an ACL with fewer than three entries as empty Chuck Lever
2026-09-24 21:22 ` [PATCH v1 1/2] nfs_common: Do not encode an ACL with fewer than three entries Chuck Lever
2026-10-02 17:24 ` Anna Schumaker
2026-09-24 21:22 ` Chuck Lever [this message]
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=20260924212246.114355-3-cel@kernel.org \
--to=cel@kernel.org \
--cc=anna@kernel.org \
--cc=dai.ngo@oracle.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neil@brown.name \
--cc=okorniev@redhat.com \
--cc=tom@talpey.com \
--cc=trond.myklebust@hammerspace.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.