Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3938919rwb; Tue, 8 Nov 2022 10:02:21 -0800 (PST) X-Google-Smtp-Source: AMsMyM6jie2hIWzi/OMqW//rokdwVJaS+Nfm3PdqfF2xyAu7vHRuOWFj0kBnBIKH4SIdroc7LVSA X-Received: by 2002:a17:902:b20a:b0:178:6f5b:f903 with SMTP id t10-20020a170902b20a00b001786f5bf903mr58898835plr.39.1667930540827; Tue, 08 Nov 2022 10:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667930540; cv=none; d=google.com; s=arc-20160816; b=wLTmJHC9PWyUSVTBfoBHSG08jRqW/kKrMNz5uVJsm93ZEcBQmAlhG2MauQQxJG1ogH rarxv+prM0B2oaRCeVJF9qIPADmjlLmrDEKuiif9kW6HBJ9OKefifPc2p3X7898m1+in JuRk6h25tiPpd5tftmE9zV2lWGS4ylz4tf4K/wzF296PEV1CNG7NWGvEvwxPrEKJceu0 u9qTatbkdF+FVEcl4ymZa6gOxiePHbS6JVpiP+6+ongaI/gDeUxboUfVMJbaizjCrXb3 CKBHZZCbxI5fKXTXPwO5Sl6co9V8HbtlHA2JM8TU8WIQdOPs/h8oZ33GDtG5BqV5Ma+a 3hdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=VrBtgM7L/EMiyujqSzOf/4EdwnNKHGPhzY1olMdrw40=; b=F399uBUWmxGL0t5PeCo+FPoL7CGH2er1kHTZoS7ZAzy92KE7CzE/NwkXgrc4UwHsMI tJzZJZzruZHFImizsfW6G/KtcTsuvjVJ3y6KJ2j2HqV0bM2kZ62Chmb2kGNRi72DzFAI eeY+yl0dLOIMyuwgg90kXS8fEj/kL93ean0toaiFGhDxcA2s8gA/wMJUbk+z9Ao1TGob R0fihu7n9SdbDHdmUNgAAmcvUNuZfwjmTxrYFsEfJ6jcSRg1RYuSl7cyfQ8Ss7Hj0lvi fegXXyZ7Xg1v+1wDbtXyru9fUiN1bFWut4gySN/fVY7utj/ShCRvaz481TLQzfoWF+9f NGxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sSd+n7EE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a17090a5d9800b0021382853a8asi17484178pji.81.2022.11.08.10.02.08; Tue, 08 Nov 2022 10:02:20 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sSd+n7EE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234429AbiKHRXs (ORCPT + 91 others); Tue, 8 Nov 2022 12:23:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234413AbiKHRXm (ORCPT ); Tue, 8 Nov 2022 12:23:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13E15EA6; Tue, 8 Nov 2022 09:23:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD3DC614FA; Tue, 8 Nov 2022 17:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B956C433D6; Tue, 8 Nov 2022 17:23:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667928215; bh=hQg7NoKja9TGe1uumJQDYjviyfCTnfLxmswlsfS/doA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=sSd+n7EE0MNX8tHp3LUL4qUnk/MPwMLUQgiWCVIl7kax2vTSV/3xCxAlRW5WHEC0x drPFNSZrYwOh7acWU1RUVu/qXRWXj4K9KBW5Gpl2ZOfmuZd4YCl9In1ysJNm99LCkc oeacoG/asj5IgNc8yKo5f5Bsa6JQ1oXUzq/3qyXApUv26+lD0D3qDGKgFaJA52Ub/J mHYT1nLia7/P3lq7RXvHJJVbPA66HFsULrud/EBTMd1GYrJhcfbLwHNfqCxnQOm5oO th7Hrptz99tmaYorsTtnWTlKcZq2xgZ0b8XhP46c+WMveHDJirW5AqfDfkqDMcl4/J kKcPWw5HxOhNA== Date: Tue, 8 Nov 2022 10:23:31 -0700 From: Keith Busch To: Christoph Hellwig Cc: Gerd Bayer , Jens Axboe , 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: References: <20221108074846.GA22674@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221108074846.GA22674@lst.de> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Tue, Nov 08, 2022 at 08:48:47AM +0100, Christoph Hellwig wrote: > 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. This looks good to go. I vote apply for 6.1, and we should consider merging your larger refactor for 6.2 after more test/review. Reviewed-by: Keith Busch > 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); > } >