From nobody Thu Jul 25 19:33:29 2024 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 4WVLf16gCSz5R8Y3; Thu, 25 Jul 2024 19:33:29 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WVLf14tvDz40h2; Thu, 25 Jul 2024 19:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721936009; 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=SMvyKSbuxEPqFPXJQ3pLcXKc1ogxB8Zi1sHRG3h/fhQ=; b=Ts8KQ/0lpttVR99MBgTzALIwm0ESVOXEiO4zTFZiK0NUNcZqlF7Umhc0q/X50DsjYjPmC+ zz16mvg+dFK7qIzX4YCOS+ZOKr1gmcXUM9pQBNWyZ70+wt0IQMeq8Uil/SH4+XISeG69Lb PkKKp2YInvfZF2hMHziJQMcz51JIDho2/74b8FoxpYIAoxNDk4wyJphhXCdgL1y/zqcceg OjR7DnRaeBVE1zogvXFImfDhbIzeKGD2dhDcNIgXOu9Xn8gwDDn1T1kQq6CRwafYRGSgHh 1RvvzB8cfaHk813oCa9XgQAL7uoXekX1hwKszb1tDjvgVxVCKvTHE/0g/SYKjQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721936009; a=rsa-sha256; cv=none; b=LWnumIkO1tWf83PTAdnPOBiaSTmLmq3vBNtCBUrF9EMsLYZVFoyo68Q8jmKY8Ul8PyQUbN tgCLecF7XLrpHN5WhEyBPs0peV1d2g2rD9vUZmxOiiL/9PeXIkztF5EfTCL75cGV8i+zfV TDEMf7IX6WIPLT6djw5Y1yzV+bgcxLqqR4bUflycFUkHcgoJoImzxVlXhDsCnWWuCay0pE 4w+uF7Wl+2veiLDgZuwipG7REfS1049kVYOWww28onROLGK0ObxGpRWSBW8dm2WS4oQccS mKlQrdECLtrD+5KCFNQVj2yzHPQe9XqEm1HuWqKBd1/Q0kmnQ8wlLMUhV31/iw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721936009; 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=SMvyKSbuxEPqFPXJQ3pLcXKc1ogxB8Zi1sHRG3h/fhQ=; b=SQlu4LX0F5pQia3aKnlrDn4prQuTe8S3m+v2b+FarYZ0S66IW/xs2GDYh/YI+yv9xsSiYp ThLWw7SS+yXrho7YEstxltEKL+pY3PLjmD5IqZLqe/xpB805RsyxRpsMK6KKL8a4mHp14p il3N0su1FPUpfEn/mZ0OLLqKuFZN6dPkl/Q26kjne0lziz1gldvuUrwJ6xgr8GNEl9Kp2A B+ywI4NC9lJcjD/GDH7MjGxLkkg9LRMTwQ+YBCdcsQy/7gNRnRW8lnSs3wl52FyJGpgejb Bjyp4faX7bN2ht6/SVnnCoiYKAgWxAqA/73d7oe41/QLUm2gqoij5Js4vgxkEA== 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 4WVLf14Sczz16rV; Thu, 25 Jul 2024 19:33:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46PJXT5W042696; Thu, 25 Jul 2024 19:33:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46PJXT8u042693; Thu, 25 Jul 2024 19:33:29 GMT (envelope-from git) Date: Thu, 25 Jul 2024 19:33:29 GMT Message-Id: <202407251933.46PJXT8u042693@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: fd0e6af5e49c - main - libnvmf: Require MAXH2CDATA to be a multiple of 4 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fd0e6af5e49c3db034f1c45ff3f053f282e758c3 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fd0e6af5e49c3db034f1c45ff3f053f282e758c3 commit fd0e6af5e49c3db034f1c45ff3f053f282e758c3 Author: John Baldwin AuthorDate: 2024-07-25 19:32:38 +0000 Commit: John Baldwin CommitDate: 2024-07-25 19:32:38 +0000 libnvmf: Require MAXH2CDATA to be a multiple of 4 The spec says MAXH2CDATA to is "a multiple of dwords and should be no less than 4,096". Sponsored by: Chelsio Communications --- lib/libnvmf/nvmf_tcp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libnvmf/nvmf_tcp.c b/lib/libnvmf/nvmf_tcp.c index b9bf8153ab1b..89fc65bf6c43 100644 --- a/lib/libnvmf/nvmf_tcp.c +++ b/lib/libnvmf/nvmf_tcp.c @@ -956,6 +956,7 @@ tcp_connect(struct nvmf_tcp_qpair *qp, struct nvmf_association *na, bool admin) struct nvmf_tcp_association *ta = TASSOC(na); struct nvme_tcp_ic_req ic_req; struct nvme_tcp_ic_resp ic_resp; + uint32_t maxh2cdata; int error; if (!admin) { @@ -1007,9 +1008,9 @@ tcp_connect(struct nvmf_tcp_qpair *qp, struct nvmf_association *na, bool admin) * some large value and report larger values as an unsupported * parameter? */ - if (le32toh(ic_resp.maxh2cdata) < 4096) { - na_error(na, "Invalid MAXH2CDATA %u", - le32toh(ic_resp.maxh2cdata)); + maxh2cdata = le32toh(ic_resp.maxh2cdata); + if (maxh2cdata < 4096 || maxh2cdata % 4 != 0) { + na_error(na, "Invalid MAXH2CDATA %u", maxh2cdata); nvmf_tcp_report_error(na, qp, NVME_TCP_TERM_REQ_FES_INVALID_HEADER_FIELD, 12, &ic_resp, sizeof(ic_resp), sizeof(ic_resp)); @@ -1021,7 +1022,7 @@ tcp_connect(struct nvmf_tcp_qpair *qp, struct nvmf_association *na, bool admin) qp->header_digests = ic_resp.dgst.bits.hdgst_enable != 0; qp->data_digests = ic_resp.dgst.bits.ddgst_enable != 0; qp->maxr2t = params->tcp.maxr2t; - qp->maxh2cdata = le32toh(ic_resp.maxh2cdata); + qp->maxh2cdata = maxh2cdata; if (admin) /* 7.4.3 */ qp->max_icd = 8192;