nvmf/tcp: do cleanup in nvmf_tcp_poll_group_add()
we don't remove the socket fd from socket group when nvmf_tcp_poll_group_add() return error, and when closing the socket there is an assertion. This was found via llvm_nvme_fuzz via TCP transport. Change-Id: Ib4ab6fc3fc5e2bc6a9545f6ce854bae8f1157fd5 Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10849 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
c7f33deaae
commit
2bd41c5187
@ -2749,14 +2749,6 @@ nvmf_tcp_poll_group_add(struct spdk_nvmf_transport_poll_group *group,
|
||||
tgroup = SPDK_CONTAINEROF(group, struct spdk_nvmf_tcp_poll_group, group);
|
||||
tqpair = SPDK_CONTAINEROF(qpair, struct spdk_nvmf_tcp_qpair, qpair);
|
||||
|
||||
rc = spdk_sock_group_add_sock(tgroup->sock_group, tqpair->sock,
|
||||
nvmf_tcp_sock_cb, tqpair);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Could not add sock to sock_group: %s (%d)\n",
|
||||
spdk_strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = nvmf_tcp_qpair_sock_init(tqpair);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Cannot set sock opt for tqpair=%p\n", tqpair);
|
||||
@ -2775,6 +2767,14 @@ nvmf_tcp_poll_group_add(struct spdk_nvmf_transport_poll_group *group,
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = spdk_sock_group_add_sock(tgroup->sock_group, tqpair->sock,
|
||||
nvmf_tcp_sock_cb, tqpair);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Could not add sock to sock_group: %s (%d)\n",
|
||||
spdk_strerror(errno), errno);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tqpair->group = tgroup;
|
||||
nvmf_tcp_qpair_set_state(tqpair, NVME_TCP_QPAIR_STATE_INVALID);
|
||||
TAILQ_INSERT_TAIL(&tgroup->qpairs, tqpair, link);
|
||||
|
Loading…
Reference in New Issue
Block a user