Date: Thu, 25 Jul 2024 19:33:29 GMT From: John Baldwin <jhb@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: fd0e6af5e49c - main - libnvmf: Require MAXH2CDATA to be a multiple of 4 Message-ID: <202407251933.46PJXT8u042693@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=fd0e6af5e49c3db034f1c45ff3f053f282e758c3 commit fd0e6af5e49c3db034f1c45ff3f053f282e758c3 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-07-25 19:32:38 +0000 Commit: John Baldwin <jhb@FreeBSD.org> 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407251933.46PJXT8u042693>