From 9e9da4675f2462ecdf092a42d40000e96aae734d Mon Sep 17 00:00:00 2001 From: MengjinWu Date: Fri, 16 Dec 2022 12:25:17 +0000 Subject: [PATCH] nvmf/tcp: fix async bugs when ddgst enalbed If host disconnect the connection when fabric commands are offload to DSA, there will be use-after-free problems. Now, disable the offload of fabrics command. Fix issue 2828 Signed-off-by: MengjinWu Change-Id: I669b01728e1ad275b7b121d47141bdf3fe5f7d9f Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15992 Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Changpeng Liu --- lib/nvmf/tcp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/nvmf/tcp.c b/lib/nvmf/tcp.c index cdec955f8..8a3d25217 100644 --- a/lib/nvmf/tcp.c +++ b/lib/nvmf/tcp.c @@ -1909,7 +1909,8 @@ nvmf_tcp_pdu_payload_handle(struct spdk_nvmf_tcp_qpair *tqpair, struct nvme_tcp_ SPDK_DEBUGLOG(nvmf_tcp, "enter\n"); /* check data digest if need */ if (pdu->ddgst_enable) { - if (!pdu->dif_ctx && tqpair->group && (pdu->data_len % SPDK_NVME_TCP_DIGEST_ALIGNMENT == 0)) { + if (tqpair->qpair.qid != 0 && !pdu->dif_ctx && tqpair->group && + (pdu->data_len % SPDK_NVME_TCP_DIGEST_ALIGNMENT == 0)) { rc = spdk_accel_submit_crc32cv(tqpair->group->accel_channel, &pdu->data_digest_crc32, pdu->data_iov, pdu->data_iovcnt, 0, data_crc32_calc_done, pdu); if (spdk_likely(rc == 0)) {