Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp159888pxu; Tue, 5 Jan 2021 07:35:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJxd/OdQMvvQgQ9+nHYbHKe0uDyVOP9iME3suLJ/ypFjPRezdsRIXQz12gOTv5BdHM0dTwgn X-Received: by 2002:a17:906:d8dc:: with SMTP id re28mr71446048ejb.168.1609860924830; Tue, 05 Jan 2021 07:35:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609860924; cv=none; d=google.com; s=arc-20160816; b=LMi9duLP/bgo8tQuzEO3+lTksPZrTh8MWtSBIY96MY0r1djwR5O/27K4IJ0nkbxb5d CE60CtQ5/01PA1k1P2wvhH0xFHsxrcMZ5J3iXSauwDnEFjDKas9eh9DABaVYsEjVmAw3 kbkc5ZmrbTie2AnA/VpOV/Yn9bzWwIIRAnyCiR9Ps0xnLbN/Z/6oq7JUkY2JO0qZLMcH mzT4T4S+WbT5z4r580+YqGU4nrZhJlZF+bMlYxBqkUK7DPT44ucF99pMwAeGF28RW03N N2FeHBhy3wYzPQmxun6ZUKUjQ6cD6VZHvBNexRuIbML9CdOSEEtxsrtmrlBOjXQASuCR 9uRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :sender:dkim-signature; bh=AEPcFkkW+BzzpizK6dn04qQ1b3yoPd7eaMzroqgeS8Q=; b=jdGxar18HRcGzZJRtEyJKtZGXiVKcddrODr7HkRVGbM4uBRyi8XCZ7Nr1piaO44I1B Mz4pYSOBQehScphH/vs57ynntTQya7EhOI6YxI1eiVlobcDYibAKmuMetmg3XVQ3kWPi mzKaIGMYiVQ5Y0ydhBOoTF468lrtpVJXJhu/FfetitMEAVGFVMx9nlsGikny7X+cXJsJ JmfItl5j7/JuggkcJjqLz5hSSd0noqzlgUrH8+GDnp0PJmweU6Ym2kTAvdL955cRs542 GC3yKWGJUFgFoOr8whU+IFuMlulOgVFHi7GX7vt2700+cFV22y0W6Uaq/KsiiwYCfCOe PYDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uCemquH6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si35518638eda.107.2021.01.05.07.35.04; Tue, 05 Jan 2021 07:35:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=uCemquH6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728064AbhAEPdX (ORCPT + 99 others); Tue, 5 Jan 2021 10:33:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728041AbhAEPdX (ORCPT ); Tue, 5 Jan 2021 10:33:23 -0500 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD65C061793 for ; Tue, 5 Jan 2021 07:32:42 -0800 (PST) Received: by mail-qk1-x733.google.com with SMTP id v126so26717856qkd.11 for ; Tue, 05 Jan 2021 07:32:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=AEPcFkkW+BzzpizK6dn04qQ1b3yoPd7eaMzroqgeS8Q=; b=uCemquH6w/hD5X4glDeABKzm916gTCYJRHsKa+gfRFCfr9LyP26OaOwcfpWLR508DK oEfPx1AxNqmpvt8xldFXWb4//zvUwbma/fOG/wGdTZNEKqgi08X+turm0gxqVjVHbXMI Qw7ZjAvgfmm0TxCC07DuAXB/9fwTvOB3oHBfxTsEiLkxb7dHhkBvtzyosGww5ymWEj3C b/Qp6rtLLfQgKyXy3vNnZ6J9DK3UNRWRLV4FoyoTALj9gBmn6gtBF+VzJz3AgxUQlzhX GmYKbUnZ9QdnxGldAUoZUpibJ+Oi1K1O00cqDl1LOgOxVkYnkA/L5/oAF0vnAGTSOoG+ TAxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=AEPcFkkW+BzzpizK6dn04qQ1b3yoPd7eaMzroqgeS8Q=; b=fEUO24MyQD6oBZb2fZbqn4V5sI3Ckk3Og6JdrxWNhj4uPbpR9/nM5RxvMqgluCmQ5d oj9hHbogOINRNnHhvQuZTrwBjV8dWG/FSaEFJDpOYfBNufNaMw23kCqsG9meiIGTUwnd 6i/bj9ABhmoBnx1Q+ykkspQX2epavSmuqz2oZlYf/IVQUU3mShaYLFqr5sp8Oesf1iv2 pF/xpkEsKtTAaAC1O9160+hKBVENEf1Uu19DLhc9YeQIu/YkEbjs3v4cc0eOArR/3QJA IE4kfROZjqhOZQvEaXdB+2wLjNhWyNZGRkZEzut9QO4oRX5lezPprflfRkaPdupuFpo2 tPeg== X-Gm-Message-State: AOAM5325p9VexWyLyqnmTtbu/JDBnP3CNXe8kxcjcqTiiid4f6sy7zwb Bos8pwCIoJd4OmtDagWmSt6HCr1YyZU= X-Received: by 2002:a37:a80a:: with SMTP id r10mr2454qke.467.1609860761660; Tue, 05 Jan 2021 07:32:41 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id w8sm46457qts.50.2021.01.05.07.32.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jan 2021 07:32:41 -0800 (PST) Sender: Chuck Lever Received: from klimt.1015granger.net (klimt.1015granger.net [192.168.1.55]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 105FWeIR020922 for ; Tue, 5 Jan 2021 15:32:40 GMT Subject: [PATCH v1 34/42] NFSD: Update the NFSv2 GETACL argument decoder to use struct xdr_stream From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Tue, 05 Jan 2021 10:32:40 -0500 Message-ID: <160986076005.5532.6867620081951278716.stgit@klimt.1015granger.net> In-Reply-To: <160986050640.5532.16498408936966394862.stgit@klimt.1015granger.net> References: <160986050640.5532.16498408936966394862.stgit@klimt.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Signed-off-by: Chuck Lever --- fs/nfsd/nfs2acl.c | 10 +++++----- fs/nfsd/nfsxdr.c | 11 ++++++++++- fs/nfsd/xdr.h | 1 + fs/nfsd/xdr3.h | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/fs/nfsd/nfs2acl.c b/fs/nfsd/nfs2acl.c index 899762da23c9..df2e145cfab0 100644 --- a/fs/nfsd/nfs2acl.c +++ b/fs/nfsd/nfs2acl.c @@ -188,17 +188,17 @@ static __be32 nfsacld_proc_access(struct svc_rqst *rqstp) static int nfsaclsvc_decode_getaclargs(struct svc_rqst *rqstp, __be32 *p) { + struct xdr_stream *xdr = &rqstp->rq_arg_stream; struct nfsd3_getaclargs *argp = rqstp->rq_argp; - p = nfs2svc_decode_fh(p, &argp->fh); - if (!p) + if (!svcxdr_decode_fhandle(xdr, &argp->fh)) + return 0; + if (xdr_stream_decode_u32(xdr, &argp->mask) < 0) return 0; - argp->mask = ntohl(*p); p++; - return xdr_argsize_check(rqstp, p); + return 1; } - static int nfsaclsvc_decode_setaclargs(struct svc_rqst *rqstp, __be32 *p) { struct nfsd3_setaclargs *argp = rqstp->rq_argp; diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index f2cb4794aeaf..5ab9fc14816c 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c @@ -38,7 +38,16 @@ decode_fh(__be32 *p, struct svc_fh *fhp) return p + (NFS_FHSIZE >> 2); } -static bool +/** + * svcxdr_decode_fhandle - Decode an NFSv2 file handle + * @xdr: XDR stream positioned at an encoded NFSv2 FH + * @fhp: OUT: filled-in server file handle + * + * Return values: + * %false: The encoded file handle was not valid + * %true: @fhp has been initialized + */ +bool svcxdr_decode_fhandle(struct xdr_stream *xdr, struct svc_fh *fhp) { __be32 *p; diff --git a/fs/nfsd/xdr.h b/fs/nfsd/xdr.h index d700838f6512..035c99c7b384 100644 --- a/fs/nfsd/xdr.h +++ b/fs/nfsd/xdr.h @@ -165,5 +165,6 @@ void nfssvc_release_readres(struct svc_rqst *rqstp); /* Helper functions for NFSv2 ACL code */ __be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp, struct kstat *stat); __be32 *nfs2svc_decode_fh(__be32 *p, struct svc_fh *fhp); +bool svcxdr_decode_fhandle(struct xdr_stream *xdr, struct svc_fh *fhp); #endif /* LINUX_NFSD_H */ diff --git a/fs/nfsd/xdr3.h b/fs/nfsd/xdr3.h index 64af5b01c5d7..43db4206cd25 100644 --- a/fs/nfsd/xdr3.h +++ b/fs/nfsd/xdr3.h @@ -102,7 +102,7 @@ struct nfsd3_commitargs { struct nfsd3_getaclargs { struct svc_fh fh; - int mask; + __u32 mask; }; struct posix_acl;