Spdk/lib/nvme
Fengnan Chang 958d4e0e05 nvme: fix memleak when submit request failed
Some memory alloc in nvme_allocate_request_user_copy, and submit
through nvme_qpair_submit_request, if nvme ctrlr is failed or
qpair state not meet the requirements, submit will return -ENXIO,
and call nvme_free_request(), but it will not free
req->payload.contig_or_cb_arg, those memory only gets freed when the
request is actually completed, through nvme_user_copy_cmd_complete().
Let's fix this by add check when submit failed.

Fixes issue #2832
Change-Id: I54f0fc60dbb53ced9f52da7d89017be13db2eee1
Signed-off-by: Fengnan Chang <changfengnan@bytedance.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15985
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Xiaodong Liu <xiaodong.liu@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
2023-01-05 23:26:42 +00:00
..
Makefile nvme: Add a helper function to return status type string 2023-01-04 08:22:31 +00:00
nvme_ctrlr_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ctrlr_ocssd_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ctrlr.c nvme: fix memleak when submit request failed 2023-01-05 23:26:42 +00:00
nvme_cuse.c build: compile API functions with missing deps 2022-11-18 08:40:05 +00:00
nvme_cuse.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_discovery.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_fabric.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_internal.h nvme_rdma: Support TOS for RDMA initiator 2023-01-05 19:54:53 +00:00
nvme_io_msg.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_io_msg.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ns_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ns_ocssd_cmd.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_ns.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_opal_internal.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_opal.c misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
nvme_pcie_common.c nvme: fix memleak when submit request failed 2023-01-05 23:26:42 +00:00
nvme_pcie_internal.h update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_pcie.c nvme: execute hotplug monitor even if hotplug_fd < 0 2022-11-21 16:15:44 +00:00
nvme_poll_group.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_qpair.c nvme: fix memleak when submit request failed 2023-01-05 23:26:42 +00:00
nvme_quirks.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_rdma.c nvme_rdma: Support TOS for RDMA initiator 2023-01-05 19:54:53 +00:00
nvme_tcp.c misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
nvme_transport.c misc: Fix spelling mistakes 2022-12-09 08:16:18 +00:00
nvme_vfio_user.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
nvme_zns.c Replace most BSD 3-clause license text with SPDX identifier. 2022-06-09 07:35:12 +00:00
nvme.c update Intel copyright notices 2022-11-10 08:28:53 +00:00
spdk_nvme.map nvme: Add a helper function to return status type string 2023-01-04 08:22:31 +00:00