From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E81DF23B604; Mon, 9 Feb 2026 14:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647495; cv=none; b=i0R34r3yodUgMaWQd83XVO3qx5UUaCkBbOFjFN5y7/CwEYmY8GKpDAYEUOrpGFLX93MwHGoqUVmOwcgX0Vhff+OJoD28jGj49ZYRUHb+OFkN3gdUgd+85Hn4K7Hiu+58bNN85x/Tf55HldO878asjIp+IUc4NPhpUJScfa+/OG0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770647495; c=relaxed/simple; bh=CGi9VzR0k+qlN2VAIRWiumyxqsCmZEXm+fm6+SBJGH0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nhpXzlLWaCI9WvastzxoqsJQ3HiS6VeI6+FzW3pFOdDpK6g/qGtnASKtczo9kbJXPcbOVYIR1Kb5QxowTleXikOl1evHJyd84ds4XY09spXyGmjZw+OhiKpUOZUpe579ibDuQRI2bTPqRcmYI3AwzENedqwluPMTbBn9cw5FFso= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=O265JOEl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="O265JOEl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0ECC8C116C6; Mon, 9 Feb 2026 14:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1770647494; bh=CGi9VzR0k+qlN2VAIRWiumyxqsCmZEXm+fm6+SBJGH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O265JOEl7E/8muvaNmDJMvEZebolxC49GuxMHW3NszPJ96nWABkkGaFZtgjWHPxgN oaXZlat0CAu7Ie2I/4DMAkscqkvW5QLH4Bxu7BYLtNBiUC7VlGZEERlGml/REKDqRP yVjF8aHfdh/F/jHUiOzuQ54OUYI8HPZ8LHIiFO5o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yi Zhang , Justin Tee , Chaitanya Kulkarni , Keith Busch , Sasha Levin Subject: [PATCH 6.18 089/175] nvme-fc: release admin tagset if init fails Date: Mon, 9 Feb 2026 15:22:42 +0100 Message-ID: <20260209142323.634441067@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260209142320.474120190@linuxfoundation.org> References: <20260209142320.474120190@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chaitanya Kulkarni [ Upstream commit d1877cc7270302081a315a81a0ee8331f19f95c8 ] nvme_fabrics creates an NVMe/FC controller in following path: nvmf_dev_write() -> nvmf_create_ctrl() -> nvme_fc_create_ctrl() -> nvme_fc_init_ctrl() nvme_fc_init_ctrl() allocates the admin blk-mq resources right after nvme_add_ctrl() succeeds. If any of the subsequent steps fail (changing the controller state, scheduling connect work, etc.), we jump to the fail_ctrl path, which tears down the controller references but never frees the admin queue/tag set. The leaked blk-mq allocations match the kmemleak report seen during blktests nvme/fc. Check ctrl->ctrl.admin_tagset in the fail_ctrl path and call nvme_remove_admin_tag_set() when it is set so that all admin queue allocations are reclaimed whenever controller setup aborts. Reported-by: Yi Zhang Reviewed-by: Justin Tee Signed-off-by: Chaitanya Kulkarni Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/fc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c index 8324230c53719..bf78faf1a4ffa 100644 --- a/drivers/nvme/host/fc.c +++ b/drivers/nvme/host/fc.c @@ -3584,6 +3584,8 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, ctrl->ctrl.opts = NULL; + if (ctrl->ctrl.admin_tagset) + nvme_remove_admin_tag_set(&ctrl->ctrl); /* initiate nvme ctrl ref counting teardown */ nvme_uninit_ctrl(&ctrl->ctrl); -- 2.51.0