From 1d3e0340b411a2edeface18fe4e6c3d531984611 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Thu, 22 Nov 2018 17:25:29 +0100 Subject: [PATCH] nvme: fix pci device leak when detaching a controller in primary process This case isn't particularly supported, but still caused a memory leak and rendered the pci device inaccessible for the rest of the primary process lifetime. This happens when a controller is removed from the primary process while a secondary process still uses it. The controller will likely misbehave without its primary process managing it, but at least there won't be a leak. Change-Id: I67581cffa33ce14ff516b5743d13c9ef7b351625 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/434408 Chandler-Test-Pool: SPDK Automated Test System Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris --- lib/nvme/nvme_ctrlr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/nvme/nvme_ctrlr.c b/lib/nvme/nvme_ctrlr.c index f3575a36f..7dcf9b11e 100644 --- a/lib/nvme/nvme_ctrlr.c +++ b/lib/nvme/nvme_ctrlr.c @@ -1686,7 +1686,7 @@ nvme_ctrlr_remove_process(struct spdk_nvme_ctrlr *ctrlr, TAILQ_REMOVE(&ctrlr->active_procs, proc, tailq); - if (!proc->is_primary && ctrlr->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) { + if (ctrlr->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) { spdk_pci_device_detach(proc->devhandle); }