From nobody Thu Dec 09 22:19:11 2021 X-Original-To: dev-commits-src-main@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 B3FC718DD4D3; Thu, 9 Dec 2021 22:19:11 +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 4J97jq2Fzqz3ljK; Thu, 9 Dec 2021 22:19:11 +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 2D5FF6CEF; Thu, 9 Dec 2021 22:19:11 +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 1B9MJBXO014211; Thu, 9 Dec 2021 22:19:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B9MJBIx014210; Thu, 9 Dec 2021 22:19:11 GMT (envelope-from git) Date: Thu, 9 Dec 2021 22:19:11 GMT Message-Id: <202112092219.1B9MJBIx014210@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: d9931c25617d - main - nfscl: Sanity check the callback tag length List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: d9931c25617d6625e280fda19bd9c2878e49c091 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639088351; 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=DFG9nZNtgr/uZq+j6Q/gyWbstI+7bDCxHRGlkiWM1Vs=; b=IJAtGL7bO+sLlokakQizBoZ7KnELVM7FgUiHpd6DBfwshMwWibSAxckY+rJ2+3KyVlA8lW 0s9eMlTfqV/Rj37IjJRSnyBkAKmNMFWGdnBGtFePM4xqYqxoSXy32PFfhoUN5KuX6AhMbM 7/OrJF1xLFE/dgLmeoX1XBTYZAwE81vKA3SXowIcfCjLdk7y7lGsuEOLHQoWkfALRQRsHn K77PjuZBULGGCT8qOFCdmse+JpnqM00CXO8s+dSTiBjlxGenJUJdkzMl1GEQ4jBubaAS/h iFy96Zo7NmR7ccdhwm28o4l09bpopkOd8TikVqhQDDab+pXPymnmhbE7Iu5QYQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639088351; a=rsa-sha256; cv=none; b=IgOjjY7XqbyMzVYNeC2AYVoh2LumHVlakdSnwxBLpFzV+4sBPqzXG5wZBIam1FIi0b4VRA s6uo7rGdiKu4xbEHGJdOn84qWzEjeA/FGVv2Kat1exdG9Rfomo6N/rL7VqfTVe7xWjlFY+ Zee8sUw5x3owVTH+YOx8OP9Wo9vH3KQwYcwX0FTzSysRsutKF+QavFXxtMLaQmJsh8/xwu QqBHZy0FjsXlE1gG1yjIv9t8oXyZAeFx5Ldmpp4oCQZILPTzTCuTVuKnJ387P35w0vN/q4 wimHKrgaxQkftoOlWNYLQEiXbizZlq+arjVOAfDLEd4S2W8gYtk2aNrSrHgUsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d9931c25617d6625e280fda19bd9c2878e49c091 commit d9931c25617d6625e280fda19bd9c2878e49c091 Author: Rick Macklem AuthorDate: 2021-12-09 22:15:48 +0000 Commit: Rick Macklem CommitDate: 2021-12-09 22:15:48 +0000 nfscl: Sanity check the callback tag length The sanity check for tag length in a callback request was broken in two ways: It checked for a negative value, but not a large positive value. It did not set taglen to -1, to indicate to the code that it should not be used. This patch fixes both of these issues. Reported by: rtm@lcs.mit.edu Tested by: rtm@lcs.mit.edu PR: 260266 MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 082469aef1bc..ead90fd49c14 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3531,8 +3531,9 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) nfsrvd_rephead(nd); NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); taglen = fxdr_unsigned(int, *tl); - if (taglen < 0) { + if (taglen < 0 || taglen > NFSV4_OPAQUELIMIT) { error = EBADRPC; + taglen = -1; goto nfsmout; } if (taglen <= NFSV4_SMALLSTR)