From nobody Thu Dec 30 01:28: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 D56301912B0B; Thu, 30 Dec 2021 01:28: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 4JPVyf4VdVz4bS8; Thu, 30 Dec 2021 01:28: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 7A9AD7A49; Thu, 30 Dec 2021 01:28: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 1BU1SAAS077305; Thu, 30 Dec 2021 01:28:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BU1SABt077304; Thu, 30 Dec 2021 01:28:10 GMT (envelope-from git) Date: Thu, 30 Dec 2021 01:28:10 GMT Message-Id: <202112300128.1BU1SABt077304@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: efc08dab492c - stable/13 - nfscl: Handle CB_SEQUENCE not first op correctly 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: efc08dab492c38a0a1830d8227c9c62e70ccf5df Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640827690; 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=fqXZLR3LJCXFB6Nag1gyDaPvdyxg59c6SReJ11ZjjXE=; b=N3b6719+7KW9F8Wf0Vz0+wjxf9lEZYGmP7MqaSLnn9q6KdSE568Kp2V2cXYjsdSt02HxGx bxqa0b63s2CJw0kSOnuVoBjrE2Lapa/UG6gISod2FuyJH6sDtl6hwS3bPheCYdVk0qZZCg YI2AoCERNsGhKY5OWJw05p19Fb96C3eRKN5qbXuAG1m5lON1SfSfHQiN04QgNZxPvRo4Lq b9ed3quTHZraFWFQs660mWPwy+RuwntEBRWQw+hnIv0GohFyfUYq0m8SKPAGO430CPszgS CL9NaRr4lLu9uSW44J6g11wNIyoacn2vqEwvjncqttIcutXtQI46wq4upMBuog== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640827690; a=rsa-sha256; cv=none; b=PWs0IGAHoSinrjkNrUHSbDz8efQn0uO1DRW0WYsX9sQbg0BG4qrw9LCkW8+mQEKMYNefQD 04WcWBhgauLFmsHS0Jykxr1pEwtFfH28mbd/ifcxBfP0nAjkN3sYrz/+GMQ3yvBCwP5hzk XpUVww28nORhyPC0ly+FTPcb0MGG1fSco8vBbx83LoIurNW3+SVdjnuYwKYhWyIpmkH4H1 1E+8DZNcdSObGbqcx6A5EV8nQdB/46KfIlczRCq2bOJJID2aT1l2Q1aJD2ghLsWSEgnN1T XaneLSw0xUn0aACSKHHIZPo5j1wIuXkKq6TxP4DXsKEL7hHU2QxsiyK6nsOUEw== 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=efc08dab492c38a0a1830d8227c9c62e70ccf5df commit efc08dab492c38a0a1830d8227c9c62e70ccf5df Author: Rick Macklem AuthorDate: 2021-12-16 00:36:40 +0000 Commit: Rick Macklem CommitDate: 2021-12-30 01:24:55 +0000 nfscl: Handle CB_SEQUENCE not first op correctly The check for "not first operation" in CB_SEQUENCE was done after the slot, etc. was updated. This patch moves the check to the beginning of CB_SEQUENCE processing. While here, also fix the check for "no CB_SEQUENCE operation first" by moving the check to the beginning of callback operation parsing, since the check was in a couple of the other operations, but not all of them. PR: 260412 (cherry picked from commit e0861304a7b6b9c410db69be6148a5510c6b2d23) --- sys/fs/nfsclient/nfs_clstate.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index f34b9e3e05b6..dc86d1fded12 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3573,6 +3573,14 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) NFSM_BUILD(repp, u_int32_t *, 2 * NFSX_UNSIGNED); *repp++ = *tl; op = fxdr_unsigned(int, *tl); + nd->nd_procnum = op; + if (i == 0 && op != NFSV4OP_CBSEQUENCE && minorvers != + NFSV4_MINORVERSION) { + nd->nd_repstat = NFSERR_OPNOTINSESS; + *repp = nfscl_errmap(nd, minorvers); + retops++; + break; + } if (op < NFSV4OP_CBGETATTR || (op > NFSV4OP_CBRECALL && minorvers == NFSV4_MINORVERSION) || (op > NFSV4OP_CBNOTIFYDEVID && @@ -3584,7 +3592,6 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) retops++; break; } - nd->nd_procnum = op; if (op < NFSV42_CBNOPS) nfsstatsv1.cbrpccnt[nd->nd_procnum]++; switch (op) { @@ -3596,9 +3603,6 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) if (!error) error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); - if (error == 0 && i == 0 && - minorvers != NFSV4_MINORVERSION) - error = NFSERR_OPNOTINSESS; if (!error) { mp = nfscl_getmnt(minorvers, sessionid, cbident, &clp); @@ -3662,9 +3666,6 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) tl += (NFSX_STATEIDOTHER / NFSX_UNSIGNED); trunc = fxdr_unsigned(int, *tl); error = nfsm_getfh(nd, &nfhp); - if (error == 0 && i == 0 && - minorvers != NFSV4_MINORVERSION) - error = NFSERR_OPNOTINSESS; if (!error) { NFSLOCKCLSTATE(); if (minorvers == NFSV4_MINORVERSION) @@ -3719,8 +3720,6 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) NFSBCOPY(tl, stateid.other, NFSX_STATEIDOTHER); if (minorvers == NFSV4_MINORVERSION) error = NFSERR_NOTSUPP; - else if (i == 0) - error = NFSERR_OPNOTINSESS; NFSCL_DEBUG(4, "off=%ju len=%ju sq=%u err=%d\n", (uintmax_t)off, (uintmax_t)len, stateid.seqid, error); @@ -3831,6 +3830,10 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) } break; case NFSV4OP_CBSEQUENCE: + if (i != 0) { + error = NFSERR_SEQUENCEPOS; + break; + } NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + 5 * NFSX_UNSIGNED); bcopy(tl, sessionid, NFSX_V4SESSIONID); @@ -3852,12 +3855,9 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) } } NFSLOCKCLSTATE(); - if (i == 0) { - clp = nfscl_getclntsess(sessionid); - if (clp == NULL) - error = NFSERR_SERVERFAULT; - } else - error = NFSERR_SEQUENCEPOS; + clp = nfscl_getclntsess(sessionid); + if (clp == NULL) + error = NFSERR_SERVERFAULT; if (error == 0) { tsep = nfsmnt_mdssession(clp->nfsc_nmp); error = nfsv4_seqsession(seqid, slotid,