From nobody Sat Dec 18 01:45:13 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id DA55318FD972; Sat, 18 Dec 2021 01:45:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JG7vs4962z4rPq; Sat, 18 Dec 2021 01:45:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6ECCD26D47; Sat, 18 Dec 2021 01:45:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BI1jDhU009122; Sat, 18 Dec 2021 01:45:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BI1jDDO009121; Sat, 18 Dec 2021 01:45:13 GMT (envelope-from git) Date: Sat, 18 Dec 2021 01:45:13 GMT Message-Id: <202112180145.1BI1jDDO009121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 5ad7804beb38 - stable/12 - nfsd: Sanity check the Layouttype count List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5ad7804beb38fdc23f0f161484f5469e38c8fade Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639791913; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XPe1rY1eK6A3qbYAjaFrf+WRogKSlVb0b/oqc82r0tw=; b=EIzsLvzKQet5qezcVQMAl+9KcGzqe0hmfXc0P6pKwnXdhIVDAlyhmdYtrFclanHqDXZulE gpC7kiqZVuB61UfNMRZKDbnp8UegyUp4grL04Ks0wMabIGgLZxIUeEq/VVKZekpM/KzJ5B B4XuGpFpaJjGhkxAG5ID2tYCD9E3hv5+4Ty5B7dymXr81a4x/HEJp9WiEDRjas4GS3uvCT fbspvLksDp3y06lqjXcz887MA/4fahG0W/Jw05e21c/NtsmWfHcC6inETcP4TAiHBAoHJD TnPTnKiq4QGC2qfKj/16F1mxfwd2GKfcSMD+U7pt9rAOtG+SNa/d02pHXdmUvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639791913; a=rsa-sha256; cv=none; b=jr/IRSIguP/Hw7ne/zzuSDCDNlt8SGpBOw4a04MU40BkSs85ka08o8ggXLttR913CCihxv VktAq46NP6f80joxLFbJdhWg2qaa0+Vqrtz1D82nyCQN2BVCHnWAMIzf4lbWFJdhpSEnRn mcgeUn/ee5YKPmThzYFAuFKrHOtirvjFA+WTmRlaO2ITCneScCl+lG5ZnMhl16XAsqekXz 0h629yFsUfMIb/imywlFz9mNVyrOwOG57Aa/yViiIMMoDM+E+fRqZ0e5bWB5x/Ris6P/NN twG5Gik7EhinNLiniaX5jG3uSiC4gw0UPDT5kFuR9Qz1XW0tKoQk1TGe9DQIUw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5ad7804beb38fdc23f0f161484f5469e38c8fade commit 5ad7804beb38fdc23f0f161484f5469e38c8fade Author: Rick Macklem AuthorDate: 2021-12-04 22:18:48 +0000 Commit: Rick Macklem CommitDate: 2021-12-18 01:41:43 +0000 nfsd: Sanity check the Layouttype count PR: 260155 (cherry picked from commit 480be96e1e24617f0f152256d7453f60774fd1f3) --- sys/fs/nfs/nfs_commonsubs.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index dcdf2e96c7e8..a11feaed3fcf 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2155,6 +2155,15 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp, NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); attrsum += NFSX_UNSIGNED; i = fxdr_unsigned(int, *tl); + /* + * The RFCs do not define an upper limit for the + * number of layout types, but 32 should be more + * than enough. + */ + if (i < 0 || i > 32) { + error = NFSERR_BADXDR; + goto nfsmout; + } if (i > 0) { NFSM_DISSECT(tl, u_int32_t *, i * NFSX_UNSIGNED);