Re: [PATCH 09/10] nfsd: cap decoded POSIX ACL count to bound sort cost

Rick Macklem <[email protected]>
Newsgroups gmane.linux.nfs,gmane.linux.kernel
Message-ID <CAM5tNy7jHYEjaJk5t5sjr+2BZfiiVGgNqcQf1J1+1ad6WhUP0Q@mail.gmail.com>
On Fri, May 29, 2026 at 11:34 AM Chuck Lever <[email protected]> wrote:
>
> [ replaced broken email address for Trond ]
>
> On Thu, May 28, 2026, at 5:55 PM, Jeff Layton wrote:
>
> > diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> > index c6c50c376b23..5469c6c207ba 100644
> > --- a/fs/nfsd/nfs4xdr.c
> > +++ b/fs/nfsd/nfs4xdr.c
> > @@ -448,6 +448,8 @@ nfsd4_decode_posixacl(struct nfsd4_compoundargs
> > *argp, struct posix_acl **acl)
> >
> >       if (xdr_stream_decode_u32(argp->xdr, &count) < 0)
> >               return nfserr_bad_xdr;
> > +     if (count > NFS_ACL_MAX_ENTRIES)
> > +             return nfserr_resource;
>
> nfserr_resource is consistent with other fattr4 decoders, but
> does not make sense here, IMO. A better choice is nfserr_inval.
>
> Rick, any opinion?
My understanding is the NFS4ERR_RESOURCE is a NFSv4.0 only
error.

Looking at Table 12 in RFC8881, NFS4ERR_INVAL seems the
best fit for SETATTR, although I didn't specify that in my draft.
(It's a bit unfortunate
that there is no other error values, since NFS4ERR_INVAL gets
used for everything else, but??)

Maybe I should add that to the draft?

rick


>
>
> >       *acl = posix_acl_alloc(count, GFP_KERNEL);
> >       if (*acl == NULL)
> >
> > --
> > 2.54.0
>
> --
> Chuck Lever
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.