From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796382710; b=pJw3yhxDJvAhmNU4/5OQPF5Z3HoyBdP9SMlkyblH7uuFoetEcR/sSbzJ+Ga06KrRhFsE cwhh+XUgxTkcWJKo8hZ7+YVbM48QZ9JVjWCN7Nm4TXxiQg5IBC2mgkXeW0QMn2wZ4Y4/A h+UYg7RcCQCXfpnwLjP3pgtQtc1LbTpWxuBBI2XfMaj22M8IYWWDyLcjzgl5cH3uJpU62 3KuGc3kpmhbpH6a12aoJaejR8AkBOvgEcsQxZip8wB3ATdq+J6gFk/jemlZcRrYvMmbYW M9qs6TjgCLHCR+B2Gt64ASWy1jdKaPDenVQnZ4pEn+GrxMW2SC9OHK+wXwnEVb/3cnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796382710; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=BGSreAY+CZlXuICVnarK6NvamKWd3+ETuUTpFMQBwC0=; b=vLkKqR1vWPWVJCZbbFDrT4WUVOUpdkyzlz/tuhCv8JavEOqVk8Lu7yr3X7h788GDaKe4 PNkW0Tfo4Z+JgQycJphGbF9vpThke39S/MzETpE4eX5/iJwTI0ODdtk0IepWv5orzIdnu sDneNHGVgEgALQ7gPX5L/xBsnm4KU1QEZ6w4QipAbpJWSWpQMeD9a56EcHJXAbtQohSE9 FsPdlQ49XxuzYP408XHdQvkLtLz/0thYF6h3hvBiV5pyMcK4KHvRnKkY2w0yJmym/619N XrlqBGoMkwNKGexU+lfkzxd0kAHLdcbotx7+o7vMmOwpumkodUnatY8KKEnnWBROJNQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=F+PrbRV8; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5E22606A322; Fri, 4 Dec 2026 11:11:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=F+PrbRV8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 235051F000CE; Fri, 4 Dec 2026 11:11:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796382710; bh=BGSreAY+CZlXuICVnarK6NvamKWd3+ETuUTpFMQBwC0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F+PrbRV8hExvwJ/jdIJ4LjPSbIpU5snrKonmASV3M5V2MBr9jOfABY7BdUec5M1VY DwlIzCtRO+QyNYlGqD76AdUaoz+fa4WzZBgur7H+GcOCUkdiirtHOaYoaaOVqQM7Sm KmjkaLSPsnjGkEToSArbtkUcDp1a2rP3EUg5JfiY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christoph Hellwig , Shao Mingyin , Keith Busch Subject: [PATCH 6.18 570/703] nvmet: roll back queue bindings on connection failure Date: Fri, 4 Dec 2026 19:07:49 +0900 Message-ID: <20261204100642.929868066@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shao Mingyin commit 3f82752e089283eb8204b9d2ebd8246077031173 upstream. nvmet_install_queue() publishes the SQ controller pointer before claiming the CQ. If the CQ is already connected, it leaves the SQ pointer and the controller reference taken for it behind on failure. An install_queue() callback failure also leaves the CQ bound after clearing the SQ pointer. The reference taken in nvmet_install_queue() is in addition to the one the caller already holds: the caller's put releases the reference acquired before the call, while this one belongs to the CQ binding. It is not released on this path, so the controller stays alive and a Connect retry on the same queue keeps finding the stale binding. Clear the tentative SQ binding and release the extra reference on a CQ conflict. On a transport installation failure, destroy the CQ binding as well, so its controller table entry and reference are released. Link: https://lore.kernel.org/all/20261106015842.3534898-6-kanie@linux.alibaba.com/ Fixes: bb78836b3a7c ("nvmet: fabrics: add CQ init and destroy") Cc: stable@vger.kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Shao Mingyin Signed-off-by: Keith Busch Signed-off-by: Greg Kroah-Hartman --- drivers/nvme/target/fabrics-cmd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c index fc626c2fd2c9..6f0fc695e649 100644 --- a/drivers/nvme/target/fabrics-cmd.c +++ b/drivers/nvme/target/fabrics-cmd.c @@ -216,6 +216,8 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req) if (old) { pr_warn("queue already connected!\n"); req->error_loc = offsetof(struct nvmf_connect_command, opcode); + req->sq->ctrl = NULL; + nvmet_ctrl_put(ctrl); return NVME_SC_CONNECT_CTRL_BUSY | NVME_STATUS_DNR; } @@ -242,6 +244,7 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req) err: req->sq->ctrl = NULL; + nvmet_cq_destroy(req->cq); return ret; } -- 2.56.1