Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74B2F606A31D for ; Mon, 26 Oct 2026 10:45:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fUUPtuwW; dkim=pass (1024-bit key, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=dkcQ/M4A DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Unsubscribe-Post:List-Owner; bh=htbX1uP4YodlAzspcnE9CO4jF/EllWpzLpFRJRa7fMM=; b=fUUPtuwWZdbea9DvRL4CM6RcwG AwQVAB8IDVXfqUJLu27xG3JOWS6FQ+ehjYqTT04w2hAZ+PWU7shoS9bz7HZC8MHEe1ycAmxFSeb6G wLllIYRfqRiKThWDMmTxtaHB2G2OensB5lyAg8WzdJHZN+SZPi0qNMPRfOu4+RoYfqtR+K1Dwap2p IwbJbTMwuvXDtNRfqVaAmLKmVs4v/kMo990WYYcHHQLVSvVqXVu8MnsFF/EBgLlwNkX17VQ97Xd8Y t7mhyoMLRtlg7kDKrvNzHEZcPN7RUyTUbMCJ0IvktVMvKHRT0Xzf0HIUjo1cPNfNEOXsTP8poQ+pM rQkqJg6Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xLICV-00000002HdC-2i5x; Mon, 26 Oct 2026 10:45:11 +0000 Received: from out30-110.freemail.mail.aliyun.com ([115.124.30.110]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xLICR-00000002Hbh-3LJr for linux-nvme@lists.infradead.org; Mon, 26 Oct 2026 10:45:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1793011502; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=htbX1uP4YodlAzspcnE9CO4jF/EllWpzLpFRJRa7fMM=; b=dkcQ/M4AZyCHs5e0dF/crKrMKjt02t2W4lQWxkyqqqaAzDBzHOeEDq5z+yvteHIDf3RQgbb/PajMiQH4bWTCxXnSUiSrN7lnfHhjkvZAbc00TRxpVUGc2731VK6ZoTxWFdW+D1Kkq5J9PCm5XfZSXhR246OwsHfD/BrH7E3O8YQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R221e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045133197;MF=kanie@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0XDX7N3Y_1793011501; Received: from localhost(mailfrom:kanie@linux.alibaba.com fp:SMTPD_---0XDX7N3Y_1793011501 cluster:ay36) by smtp.aliyun-inc.com; Mon, 26 Oct 2026 18:45:01 +0800 From: Guixin Liu To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , Nilay Shroff , Daniel Wagner , Hannes Reinecke Cc: linux-nvme@lists.infradead.org Subject: [PATCH] nvmet-fc: Tear down the association when the admin queue allocation fails Date: Mon, 26 Oct 2026 18:44:56 +0800 Message-ID: <20261026104456.3672246-1-kanie@linux.alibaba.com> X-Mailer: git-send-email 2.43.7 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261026_034508_495141_47227CA3 X-CRM114-Status: GOOD ( 13.41 ) X-Spam-Score: -17.6 (-----------------) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" X-Spam-Status: No, score=-26.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 When the initial admin queue allocation fails after a new association was created, nvmet_fc_ls_create_association() only drops the association reference, which frees the association. By then the association is already on the target port's assoc_list, though, and removal from that list only happens in nvmet_fc_delete_target_assoc(), which this error path never calls. The freed association stays on the list, where later lookups and the port teardown can access it, and the target port reference taken at allocation time leaks. A remote host can trigger this reliably with a Create Association LS requesting a queue too large to allocate. Schedule the regular association teardown instead of dropping the reference directly. The teardown removes the association from the list and releases the target port reference before the final reference drop frees it. Fixes: 0cab4404874f ("nvme-fc: fix a missing queue put in nvmet_fc_ls_create_association") Cc: stable@vger.kernel.org Signed-off-by: Guixin Liu --- drivers/nvme/target/fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c index 1b557775e033..2d68a355cf79 100644 --- a/drivers/nvme/target/fc.c +++ b/drivers/nvme/target/fc.c @@ -1705,7 +1705,7 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport, be16_to_cpu(rqst->assoc_cmd.sqsize)); if (!queue) { ret = VERR_QUEUE_ALLOC_FAIL; - nvmet_fc_tgt_a_put(iod->assoc); + nvmet_fc_schedule_delete_assoc(iod->assoc); } } } -- 2.43.7