From nobody Sat Dec 18 01:36:10 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 E741318FC2D1; Sat, 18 Dec 2021 01:36:10 +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 4JG7jQ39Gfz4pX2; Sat, 18 Dec 2021 01:36:10 +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 3492A268D6; Sat, 18 Dec 2021 01:36:10 +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 1BI1aAuM095087; Sat, 18 Dec 2021 01:36:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BI1aAiP095086; Sat, 18 Dec 2021 01:36:10 GMT (envelope-from git) Date: Sat, 18 Dec 2021 01:36:10 GMT Message-Id: <202112180136.1BI1aAiP095086@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: fac8422a41e6 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: fac8422a41e61847acd06f7dab9fab9cfc2f4a74 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639791370; 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=yQv7MA+D6fZBOkijxP9xUzxLCchdqTdiM28X77LXkcY=; b=Rf0OaZZWmrkLIJmbGaBXLpox5eVEr2LxS9Bpb0lW8M8BTSS7PvJYadnQ5gke5jlUsWQXIH d77/bdW6Eq4lhwTfuBfMUL6UW9CcHvXcq+sbLqcQ2Mbk7/02Rv9M7H6hmPfPxTseeV3SQS nnn/3oYMwQFLmbuKvZxADR4K8ILrAV1POtzrB0CsHSt4yW56kEPiZXY13TmdXiyBjT53DV DraiytkFdl+KdRmaB2c4ZjD74Xe6pueBzgEMktpaJ6wLl1UZMuuWqAw3oH8W4nI8M2kshk YvQK3pf+63At6J5+tq08v8JHW8fr2t2nRRhuOdpmDhyoYWI6A+6mz66Ircq/zA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639791370; a=rsa-sha256; cv=none; b=rhGF9/DYBUUNCyVeCDZfs2dTnBT5x4TohYXz2t2xaUmsquRxNks6J4Kon5BafK1HLJJ8Kb PSQuHBPRO8i6eZAaeyD9KXU2LhmrBirDEYYYR1DBgQGY7pdaH5dz65US1wxVxlNk31UNDO K21PMup6wkrOw6mWPjUWgnrVxmxW0SxUmQTM+3Fb2YHn+hdulma+RTMoBZZhfVTCIzytwQ RQYO1G9MyygenyrWqxF3ncdWt2a2C0bvC+kYeZWNT8ZrRQ6coxr4yGjSrPqQ5ApMBSaSJZ 89NYeO8YkAF4f9fymC1S9ZZaUXjB639bX7RsN+qPQHeDtxdeuk5Qt//U2NR0GA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fac8422a41e61847acd06f7dab9fab9cfc2f4a74 commit fac8422a41e61847acd06f7dab9fab9cfc2f4a74 Author: Rick Macklem AuthorDate: 2021-12-04 22:18:48 +0000 Commit: Rick Macklem CommitDate: 2021-12-18 01:32:47 +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 29e33372e83e..5a944ffa8c1a 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2186,6 +2186,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);