NFSD: Update the NFSv2 SETACL argument decoder to use struct xdr_stream

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
This commit is contained in:
Chuck Lever 2020-11-17 11:56:26 -05:00
parent 05027eafc2
commit 68519ff2a1

View File

@ -140,28 +140,23 @@ static int nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p)
static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p) static int nfs3svc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p)
{ {
struct nfsd3_setaclargs *args = rqstp->rq_argp; struct xdr_stream *xdr = &rqstp->rq_arg_stream;
struct kvec *head = rqstp->rq_arg.head; struct nfsd3_setaclargs *argp = rqstp->rq_argp;
unsigned int base;
int n;
p = nfs3svc_decode_fh(p, &args->fh); if (!svcxdr_decode_nfs_fh3(xdr, &argp->fh))
if (!p)
return 0; return 0;
args->mask = ntohl(*p++); if (xdr_stream_decode_u32(xdr, &argp->mask) < 0)
if (args->mask & ~NFS_ACL_MASK || return 0;
!xdr_argsize_check(rqstp, p)) if (argp->mask & ~NFS_ACL_MASK)
return 0;
if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_ACL) ?
&argp->acl_access : NULL))
return 0;
if (!nfs_stream_decode_acl(xdr, NULL, (argp->mask & NFS_DFACL) ?
&argp->acl_default : NULL))
return 0; return 0;
base = (char *)p - (char *)head->iov_base; return 1;
n = nfsacl_decode(&rqstp->rq_arg, base, NULL,
(args->mask & NFS_ACL) ?
&args->acl_access : NULL);
if (n > 0)
n = nfsacl_decode(&rqstp->rq_arg, base + n, NULL,
(args->mask & NFS_DFACL) ?
&args->acl_default : NULL);
return (n > 0);
} }
/* /*