Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3592294pxv; Mon, 28 Jun 2021 08:08:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyxHXJth2vgSAcJ+7D1BE34uRHn1uA64mDDhUS6lalZU3KRRHy4b0YSjziEPq0Ta+E84wQ X-Received: by 2002:a05:6e02:dcc:: with SMTP id l12mr13799268ilj.80.1624892901415; Mon, 28 Jun 2021 08:08:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624892901; cv=none; d=google.com; s=arc-20160816; b=aU/7QTfIND+92Z1yesLwLX65zS4MOYUrSl8CZ64SigD9ULCBk24R4VJujtRfxFRErC jMOveea5TGOLhvw7NcG0Gm6dXqyf41p5zEwzJM2H/CP4Zy5E/+pZ/oWEzkNwcNp/cvmi +4ILatWKX0+2iA+MS5vvXJmD0kBznq3t0qJBnaOFCZCgFwabsBHkJqt3/5HI5fdLPnEb PrwiwoZq6iUgY0SiPSWjN5nehsWulIz3QjbZBQ+eyd2UtInmYIcaRTttfN1bZzV/GZLE 0lOSSp6ten+WLoaHnjQOwu6SxUgYQb0m9pcspicb2eLaf3yBXlKIv2x4ddZiZQxlcLTE vnFw== 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=hhd/40ERG6lxdyMUF8lJD1fjxpqDO38PWZnR6/4nlnI=; b=WVautuxDh0fT3REGExfF6fmNnMbSpANt/2LWuEOhQC8W96gIBu2pAvN09KwySMkVWe cfVJ0aDvE6e5HQujz4c1UHO8un++L6EbaEC3dUlb4WNTRdPhNFWBAyEUjKPDOWtGj7AC FPWGP5IzSqGTsEZJUGp3QYEHd61n3T7ONQ6gBWgBRjkcDcLLtSADdJQZ4g18PshWCtR1 dhJmE0R2ZiCyInqBCLj8o3u98RCJLCgazYAb/WyI6Fku8BufYCkPvrRdjpcrUA6+5poT Rh9ZsEfs77Yex4gijLmtdejYRplkGVQ2uoV2mQgs7m/QmDOExoa2z5+fkeEFn+qPa5HT Em2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e5LnRc9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d6si1961496ilr.154.2021.06.28.08.08.06; Mon, 28 Jun 2021 08:08:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e5LnRc9m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232540AbhF1PIQ (ORCPT + 99 others); Mon, 28 Jun 2021 11:08:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:54534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236329AbhF1OrX (ORCPT ); Mon, 28 Jun 2021 10:47:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DFA5561CA8; Mon, 28 Jun 2021 14:36:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624890999; bh=x2c4b1/n9pTYYdcPDTBCvUOkjOIDOUolY33xlgn3Wuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5LnRc9mH1s7H+pFbRbCC5Maxyh/DG3Zym2hJzFHo/q/SaUHkh0eMq9wZig0hcVm9 9V3ZApHtQwX3W9mYL+KXamHRGOaj5hV4LTx2HX2fPjDR70O0leDE0KtqkTMVdDf7w1 K+GVowT+5PR0MM8xQP9xccqT7BqW1+h0vMZRtL4hPeM6TE/cjEzPy/ykVyrHZ/Fsq7 mnc0mm9g/VfI8+8oT7Pw2zF0QG+b4JyJcjldfBqHwcqobjilWjiNWOIp3mqQCEHSEO 7dnuNrtpT1Fy7Ue7WxwZKrGSoRY4ijYJylhpdAyBU5I7RLJjZUWo/4bAMX4x2qrUQf LTwm3eTg7yZXw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.14 10/88] nvme-loop: reset queue count to 1 in nvme_loop_destroy_io_queues() Date: Mon, 28 Jun 2021 10:35:10 -0400 Message-Id: <20210628143628.33342-11-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210628143628.33342-1-sashal@kernel.org> References: <20210628143628.33342-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.238-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-4.14.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 4.14.238-rc1 X-KernelTest-Deadline: 2021-06-30T14:36+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke [ Upstream commit a6c144f3d2e230f2b3ac5ed8c51e0f0391556197 ] 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 Reviewed-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- 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 3388d2788fe0..5f33c3a9469b 100644 --- a/drivers/nvme/target/loop.c +++ b/drivers/nvme/target/loop.c @@ -322,6 +322,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.30.2