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=1796381304; b=4H9LkqFHHjVTwbggZT/v7DgIAj5SIYuAMvWFOD5uECImrjyEH7CIwSHMZurxyGOc/g7C 0BmPzExGfLdPeyPv/yhYrjc7h+23mHfhGG7Wy214Lg3BdhlzIUwGaN1p700xSceA1mhQ6 NpcaZdbzJKtkshoJ8ck0/GHU3RPZb4GmgrqlR+edFEbrf3l0rybrJmLSGit1f23aTseBH VcVyv80WAx9OeJhfMOtU7K/CGt936RvFvK5kb37UJVvBxdrXx+baIomSWDChp7LMC08Qg z6kUQqb10ngFp8E1+Hdh9uTv2gNXHCUZ3t/irOtDPz1D32knx5SZt4miRUc/kKUxP2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381304; 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=uUtQ0SxYBB7cFQgMSQlQz02OadlDVDwRRps6rYmJ5ME=; b=IGtj6cXauFMgSfbixbqleKmkSHmeartMgrUvn6kAY5yYtIcPw9oWRTcisxeRWN448hfg z2qSSO0TNawnEa/dS9NLm1nmMBhdWJ3mPpgI5c5wsH/zLSiudUmcjLsGkWaldSLPXnoEZ YWk6rjf51rdc+bhgaXBU5tb3yHHqYcdkxxUOgXfz0lhzd6+yMsjo6dJ6+LJvXLjpEuF8I hfFi8D9ct4ZxHe6VgdOOjO8wRYUXr6WpILIAJKwPmnpcl+dWL4XYUbBkpEaq/I7fztk+3 HP5Cb4Z5h81Ndp+voEnpqLU2OUCW+zGqFp0MhpnwWz9mHQRtylUjPJ/Ng3rgeY4RUpA== 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=EpQmFB8d; 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 20782606A322; Fri, 4 Dec 2026 10:48:23 +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=EpQmFB8d Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53EFB1F000CE; Fri, 4 Dec 2026 10:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381303; bh=uUtQ0SxYBB7cFQgMSQlQz02OadlDVDwRRps6rYmJ5ME=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EpQmFB8deArh9ya764n+4DmTkD8x6yrz7Vg4J5LLJKJwfqRVaF0Z0EEip74BLxBIu ZxmZQNYXzg9m82N5YGR4rr/4hY/0z886QSW/MGG6h4qNXzTsqKus4+lAA182y8CWcp hwsLb732IRCXv6e1+k7Odw0j0cmYC7VK42lV3oq8= 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 7.3 645/742] nvmet: roll back queue bindings on connection failure Date: Fri, 4 Dec 2026 19:08:29 +0900 Message-ID: <20261204100652.224434412@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@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 7.3-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(+) --- a/drivers/nvme/target/fabrics-cmd.c +++ b/drivers/nvme/target/fabrics-cmd.c @@ -216,6 +216,8 @@ static u16 nvmet_install_queue(struct nv 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 nv err: req->sq->ctrl = NULL; + nvmet_cq_destroy(req->cq); return ret; }