Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2422383rdh; Sun, 29 Oct 2023 15:56:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAL2wijOLcxDICN+wQ++BiJiDdEBzLanVFTIBfzS+gxBLwfiFn6P6sjLsVTZb0kOrxu7NW X-Received: by 2002:a17:902:a38e:b0:1c9:cc88:502c with SMTP id x14-20020a170902a38e00b001c9cc88502cmr8154350pla.69.1698620190527; Sun, 29 Oct 2023 15:56:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698620190; cv=none; d=google.com; s=arc-20160816; b=wKp8OxyJ5b17xiUXzpIGC8zGXFR0NThfUEvgCJHaLjhSxI2BUn7GxlTXpueyCJpgmp 0NA5QGGcIsbX2Zdm8ZCYde2dqaeJ/u8ojbYvX2Blp9+dIfl5JRwRt/gKiDnQrorhk4q7 0MXiP/vBlNZ1XbwXz6s8xUwqs6DvrZTRmfY7FFCJkeXWsYqPZEHCHLq6E7sffuPTlbR7 olTCscIHHijkoXqqzKnm4Eam0Q1ppXsAcdSRnLXU7N5TW3q0u48zYvby9/t/tCct3zDb eiJ3+B/LU6B9uDLECrSvNUYeyBh2n2C1FAgjv+0MdKn6ZUNFOUTOUOH19p3YCecXNm0Z WGMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VnfjelIRcRQGFkmbP6BHKNsUVYDFFuyyun2R9/zsNco=; fh=YYfKmu1e1/bCb9aVXOBAeh2wV5nSoMiMbmgoB5e1R6Q=; b=fCGAj9LNCo/L2fO9qQXhhUILN8LXSb8PfbP8Hyk/Qu2sobQRY0rp3LnUyK0uG2JElT PLiLRtCZ6htFJGNeOO0hoOQnVLRg7Gi/8WoQMfaeHQweXQZp0xBVkzqFvSmyngdhDANy qrVu0m3mL7/n5eDewFgDEofvMylZyRuKSZnsNh7ulxqOh5a3mw+bFf0Q+Y3tatupEIHs nwhzK2X394NobLnTZmeNya1ahIb2WcgqivANNICHGBR1nXXNYf2d45t79MBioVkBEONs GNGga0XBvWpNAK7eRm1wPqRw3vWKt4PrC74U+i9MPkK48MBXvkO3az4Ebcvax3MX+9tp ar4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tLI2pk3r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id g13-20020a170902d1cd00b001bda57935fasi4069096plb.64.2023.10.29.15.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 15:56:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tLI2pk3r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A39B780608EF; Sun, 29 Oct 2023 15:56:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbjJ2Wzu (ORCPT + 99 others); Sun, 29 Oct 2023 18:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbjJ2WzT (ORCPT ); Sun, 29 Oct 2023 18:55:19 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12D27F7; Sun, 29 Oct 2023 15:55:07 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 774F3C433C7; Sun, 29 Oct 2023 22:55:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698620107; bh=d6+abDYEVtUova+KDIxPln5hjytDhkyGRBLx/ZCBVSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tLI2pk3rXZYqXzS8vVVvtravK8O9ghccPpV4wMtH6tXrQIDbqb4KoPf69Vtr/huM2 XHka7c4OsQgvJyv7T4wwZfOp2ODibDUjJuFyLQFYwcmi6uZB/zIvUqX/TK/b+JgrAP jLL0lUtIK4Ov/Kz2ZzXKNu2RfCVJPakBd6xnFkStQazO22uxkS3fd7CLUqh4Dhst9U apjLvQS1t05nf9Uay/G/RMu+J810xOHfi+1hNwn/dK7yowioSAU6HQxbAlvK3NsDdD vNS2MxlKSBCxTzA6npDC/vuSmUT70up8d/yN9yGhUq1IXZxq2UtRGo0tM+UD5ctmO0 X0UD1NnXUMNzg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Maurizio Lombardi , Sagi Grimberg , Yi Zhang , Keith Busch , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 6.5 17/52] nvme-rdma: do not try to stop unallocated queues Date: Sun, 29 Oct 2023 18:53:04 -0400 Message-ID: <20231029225441.789781-17-sashal@kernel.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231029225441.789781-1-sashal@kernel.org> References: <20231029225441.789781-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.5.9 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Sun, 29 Oct 2023 15:56:17 -0700 (PDT) From: Maurizio Lombardi [ Upstream commit 3820c4fdc247b6f0a4162733bdb8ddf8f2e8a1e4 ] Trying to stop a queue which hasn't been allocated will result in a warning due to calling mutex_lock() against an uninitialized mutex. DEBUG_LOCKS_WARN_ON(lock->magic != lock) WARNING: CPU: 4 PID: 104150 at kernel/locking/mutex.c:579 Call trace: RIP: 0010:__mutex_lock+0x1173/0x14a0 nvme_rdma_stop_queue+0x1b/0xa0 [nvme_rdma] nvme_rdma_teardown_io_queues.part.0+0xb0/0x1d0 [nvme_rdma] nvme_rdma_delete_ctrl+0x50/0x100 [nvme_rdma] nvme_do_delete_ctrl+0x149/0x158 [nvme_core] Signed-off-by: Maurizio Lombardi Reviewed-by: Sagi Grimberg Tested-by: Yi Zhang Signed-off-by: Keith Busch Signed-off-by: Sasha Levin --- drivers/nvme/host/rdma.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 337a624a537ce..a7fea4cbacd75 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -638,6 +638,9 @@ static void __nvme_rdma_stop_queue(struct nvme_rdma_queue *queue) static void nvme_rdma_stop_queue(struct nvme_rdma_queue *queue) { + if (!test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags)) + return; + mutex_lock(&queue->queue_lock); if (test_and_clear_bit(NVME_RDMA_Q_LIVE, &queue->flags)) __nvme_rdma_stop_queue(queue); -- 2.42.0