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 058532ECE9B; Thu, 12 Mar 2026 20:22:40 +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=1773346961; cv=none; b=onazp31HVjFoDjQ2F7wf8Tx4Hr7O+ldqZSdk6+66XqhNNUxzU7VF7BgJLcSY3w3M9vaZN7XzcCzIGmWjtVpeYScWDyiq1Sad8V0CnTrpC+DdAKH+zu1aZNvn1D2ZnpV/BDQz4wiQjZ0u8MPTNw3EMiComwYn8dCxQZLdhZBrFsQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773346961; c=relaxed/simple; bh=E7poNcm2cK9XKItqYMIbQ4zoubCC5grtC55L537696s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tGdI+ybFx3qR+8np3IRzehPmw9VqMu6tATrvG9f9b05Q2xu2WJBkzpLwRqB4aOriC7V/Dfdd6yZ2VcZzkjlrfwZpPG4qYrjXaM1/SfvlLQyPHoYMYoM3fM6bdE0+M2CUs/AXjP4LIMF9wCGE1PK2fBGua7i+ThfI+liIqW6aVrM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MPkfc+bj; 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="MPkfc+bj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F977C4CEF7; Thu, 12 Mar 2026 20:22:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773346960; bh=E7poNcm2cK9XKItqYMIbQ4zoubCC5grtC55L537696s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MPkfc+bjiKI2ldHa81jnUtWppcdZpv16l5X1epZUBKf+EltpjPZmvwYmqjBHl4bMl kACucnr8QxMtXNkEuPCDa0VM9xt5A0lEZticFL1TmHKNB6Mtj14eIYIv7s8m50uRzA viK2FpTUZ6OOMRGsOUOzaxgmG2bjQxVlrxVndFyI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Keith Busch , Ming Lei , Sasha Levin , Yi Zhang Subject: [PATCH 6.12 168/265] nvme: fix admin queue leak on controller reset Date: Thu, 12 Mar 2026 21:09:15 +0100 Message-ID: <20260312201024.347810651@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260312201018.128816016@linuxfoundation.org> References: <20260312201018.128816016@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei [ Upstream commit b84bb7bd913d8ca2f976ee6faf4a174f91c02b8d ] When nvme_alloc_admin_tag_set() is called during a controller reset, a previous admin queue may still exist. Release it properly before allocating a new one to avoid orphaning the old queue. This fixes a regression introduced by commit 03b3bcd319b3 ("nvme: fix admin request_queue lifetime"). Cc: Keith Busch Fixes: 03b3bcd319b3 ("nvme: fix admin request_queue lifetime"). Reported-and-tested-by: Yi Zhang Closes: https://lore.kernel.org/linux-block/CAHj4cs9wv3SdPo+N01Fw2SHBYDs9tj2M_e1-GdQOkRy=DsBB1w@mail.gmail.com/ Signed-off-by: Ming Lei Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index a766290b1ee89..de4b9e9db45d4 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4609,6 +4609,13 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set, if (ret) return ret; + /* + * If a previous admin queue exists (e.g., from before a reset), + * put it now before allocating a new one to avoid orphaning it. + */ + if (ctrl->admin_q) + blk_put_queue(ctrl->admin_q); + ctrl->admin_q = blk_mq_alloc_queue(set, &lim, NULL); if (IS_ERR(ctrl->admin_q)) { ret = PTR_ERR(ctrl->admin_q); -- 2.51.0