Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3104139rwb; Tue, 8 Nov 2022 00:09:07 -0800 (PST) X-Google-Smtp-Source: AMsMyM57D4CRhDMC8QvI50WLE/Fa9+u4jbrbw+WSzaosrUNhIa9SxTtpMfiYBIDPtUqIsuDyWcxI X-Received: by 2002:a17:906:9b83:b0:730:b3ae:343 with SMTP id dd3-20020a1709069b8300b00730b3ae0343mr53692170ejc.670.1667894947414; Tue, 08 Nov 2022 00:09:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667894947; cv=none; d=google.com; s=arc-20160816; b=hUoqwiaJ8WV+Qi+dOcGBZhzyNDPE/2L7QYfVEIsxoZfK69lCcT93Qf8DW3DuFRkPwl Gs9i8YW0G+X962Ag0K54XMVyzD/R5tv0b18CfdxvPE/8u6LCa/u5zzkQTVJIpO2yYAYd W694Z3xgWSpXH09QshbnIGrwIZ72ljBGSw4KNc/XcChRWMRZGAwz4+gl2btcBv3GUv6a NgLE1/XmyIvvw8Tq4FbDSoZHoUyQbu6WIn2fvEBN0ZdAgUOJhzAxyTtv9BYgvMc5tPbs UOKJQbLQFp8thdBbI5K5cHtKsSzE+lWHFh8R3XzD0Gm4Ib5y7Gwr+3w4KlXlRpP4yDgo z4tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=P1S8zoVjmiogd3HCEeod/C/DMqI6dXD7xQjPEtbSfiM=; b=efJ8QGWhY1BNttq+4PCEKey0zau7ENQc6fIXkBCgni4xQS4Xegw9we1MQzmjz897NH L6BzHYIghL0vvsdS0CZLTfqebUR+yDjCo8j2bJWp7IkD06vlL72D1fAyymGqon7k6smg TSgrRj8/hm2n+HPTSKyd0cgw3ybqG9Qt6ZczIaSDhRsxuQAWeiEB0T/k3afOOgtsSrON QrAODc7CErgDduMuT2EdbiY7bAzjgq/MvskU53l0Shy+Xro9z06UJ8GOoRY7WqgdsweD CcXK9IoNIm5YSxNpVtVRQDvBOxI1Z3ff3/jtx14TgeyqHJzvAwpzh1/h8HBO7mct+1TE oXnA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec4-20020a170906b6c400b007a9e6f0f82fsi10632381ejb.516.2022.11.08.00.08.43; Tue, 08 Nov 2022 00:09:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232654AbiKHHsy (ORCPT + 90 others); Tue, 8 Nov 2022 02:48:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229843AbiKHHsw (ORCPT ); Tue, 8 Nov 2022 02:48:52 -0500 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3D9413D3D; Mon, 7 Nov 2022 23:48:50 -0800 (PST) Received: by verein.lst.de (Postfix, from userid 2407) id 2DF4067373; Tue, 8 Nov 2022 08:48:47 +0100 (CET) Date: Tue, 8 Nov 2022 08:48:47 +0100 From: Christoph Hellwig To: Gerd Bayer Cc: Jens Axboe , Christoph Hellwig , Sagi Grimberg , Niklas Schnelle , linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, linux-nvme@lists.infradead.org Subject: Re: nvme-pci: NULL pointer dereference in nvme_dev_disable() on linux-next Message-ID: <20221108074846.GA22674@lst.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Below is the minimal fix. I'll see if I sort out the mess that is probe/reset failure vs ->remove a bit better, though. diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f94b05c585cbc..577bacdcfee08 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -5160,6 +5160,8 @@ EXPORT_SYMBOL_GPL(nvme_start_freeze); void nvme_stop_queues(struct nvme_ctrl *ctrl) { + if (!ctrl->tagset) + return; if (!test_and_set_bit(NVME_CTRL_STOPPED, &ctrl->flags)) blk_mq_quiesce_tagset(ctrl->tagset); else @@ -5169,6 +5171,8 @@ EXPORT_SYMBOL_GPL(nvme_stop_queues); void nvme_start_queues(struct nvme_ctrl *ctrl) { + if (!ctrl->tagset) + return; if (test_and_clear_bit(NVME_CTRL_STOPPED, &ctrl->flags)) blk_mq_unquiesce_tagset(ctrl->tagset); }