From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55656C47082 for ; Wed, 26 May 2021 16:46:37 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0B828611C2 for ; Wed, 26 May 2021 16:46:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0B828611C2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zMeBhcZR2PlpLMU4VSnw1Nai/XOLPM4o6lkAh0LpMcA=; b=dgqkurEaa0+bqj 9rCQkud4vj0AM3fep3BgDsI6PaDt022rXkypISNGK7Q0BHe68Lo17mqYnJ0lIgOBiwNKxKh6sj72G L1/SqpISllvKY3ccEZAPyOV/M4dFbfUcJHTYCyNc7NNjP5UWzO4lywf+2goTIQOeNVpPR+IDqD/Rl w+rEqlhk++61R9X1JxofzrocdJZM6mP1pHnQNW7KBc9MLkZUzZh2EnsgLJEoJXl+fP39OJJ7e1OWS 9L83s6RF6iQKDmKp9Q0jYlcBTcMArlbjlO9O1196FnNFB2BPbfJkVjl+Vtbrq1E+lrICYTgbJBlco ooWqHpjziKwIHz4JasEQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1llwfr-00Fqfn-24; Wed, 26 May 2021 16:46:27 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1llvNb-00FKSs-TY for linux-nvme@lists.infradead.org; Wed, 26 May 2021 15:23:34 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622042608; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cFsR6VhkAtAMJS/OkfU3JSeMw3x+YflEh0NWpiyRTF8=; b=J3rXJMeY1VuSxahybDjpforduDDSv1AlIhhO23s++YKTv/6/oYezKzTaLM/bIfz0Au1x82 S+3qwAOsQvddJcWpnZ9yjPUIARA/EEIrXjF/rIpEcbg7fLGaMoDL4KtvkRUs6UmmSTdQt1 1P6++ZEEZ8niUn/RvWBMIhS5HL89Re0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622042608; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cFsR6VhkAtAMJS/OkfU3JSeMw3x+YflEh0NWpiyRTF8=; b=KCuySlM+dHAJKWqeo28aHVE/AfMEyPLyMzHAs60gs2gkWUES70NIwlc77e7FPtB8acAMiv 2gUDZbcf6R8at/Dg== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2E911B288; Wed, 26 May 2021 15:23:28 +0000 (UTC) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org, Hannes Reinecke Subject: [PATCH 1/4] nvme/loop: reset queue count to 1 in nvme_loop_destroy_io_queues() Date: Wed, 26 May 2021 17:23:15 +0200 Message-Id: <20210526152318.107202-2-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210526152318.107202-1-hare@suse.de> References: <20210526152318.107202-1-hare@suse.de> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210526_082332_228477_4BBEDD38 X-CRM114-Status: GOOD ( 10.48 ) X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org The queue count is increased in nvme_loop_init_io_queues(), so we need to reset it to 1 at the end of nvme_loop_destroy_io_queues(). Otherwise the function is not re-entrant safe, and crash will happen during concurrent reset and remove calls. Signed-off-by: Hannes Reinecke --- drivers/nvme/target/loop.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c index 74b3b150e1a5..f96ec84db8c2 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -299,6 +299,7 @@ static void nvme_loop_destroy_io_queues(struct nvme_loop_ctrl *ctrl) clear_bit(NVME_LOOP_Q_LIVE, &ctrl->queues[i].flags); nvmet_sq_destroy(&ctrl->queues[i].nvme_sq); } + ctrl->ctrl.queue_count = 1; } static int nvme_loop_init_io_queues(struct nvme_loop_ctrl *ctrl) -- 2.29.2 _______________________________________________ Linux-nvme mailing list Linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme