Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp4596481rwb; Tue, 8 Nov 2022 20:34:36 -0800 (PST) X-Google-Smtp-Source: AMsMyM4g2GdsX0QQjPDPCZZLBXyN0upWz5lygDJd6Z0SeB3sznRHtucEUrON1GrRwEh3Vsdt5sXD X-Received: by 2002:a17:902:d4ce:b0:187:17bd:44d7 with SMTP id o14-20020a170902d4ce00b0018717bd44d7mr52722179plg.84.1667968476355; Tue, 08 Nov 2022 20:34:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667968476; cv=none; d=google.com; s=arc-20160816; b=i7kP+cdRjCQThxiKrxJ6UKnjW63J9urbP4A4QYG8odKUtoB7n+GizMxM/cptpdl2mo SQ+1r+obPPlk8J5v0UuD7NJSpu5u7u/m6/7kCy/DuRWsmIzg/VAMinGqRomUJYAJV29L NVPr1jUV7qF11LHSjwJ5HrRmhlCUly0lpC1tBDZmZjuY9kVDvrIlaPxwVtH0vY2KqXmI el5T15t8c1JrSE1KVLxMMo/vWfcbcvea9/gMTQWdFxEwIAGXfcbtV0HYsvcrYmVwIFc4 LN0AzRGuO+DkPqm7cPz/MyK0xdUAiXbKadDBJE6OJISblqgCoAFKJS68fIStysiSwwHm 28Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=fyorhJCTSS6+0hPMlFzpEuVOTIRf/zjd/ug2ks95Ljg=; b=RHKmYZl+7bn8VIyAyljOqA5ztAAmrIZ04gMwG20hDvvmpHD3aAEK6RsRVGSWbeyLvC U7CnrtayYVjOws9YaMiAww6wvF3Cl+zRBJkEkydWOgSUmAwg/KtMlSPbz6dS8X58qEgC VvGC6tCxbCXm1N/2P2ZDetMy3e8rLd6xuH6ft3Tycd04pgbQBSsHNg6USGJ6hsbGPerj fM+bXpkjbzlD74X3mtPLbjC2FFzsIsLOmUmplRce2L6Gm+hwl/o+VZ2egdpLudpsg8N4 2GinybDxfzqc2LhZ14NLnA0eUtZEq6WP0TFBQmV2q/21NVROSSZnOTAwK/oXLeTa0f+g 24gA== 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 f7-20020a170902ce8700b0016ce3d67e7csi18698212plg.387.2022.11.08.20.34.22; Tue, 08 Nov 2022 20:34:36 -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 S229530AbiKICy2 (ORCPT + 93 others); Tue, 8 Nov 2022 21:54:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbiKICyX (ORCPT ); Tue, 8 Nov 2022 21:54:23 -0500 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AC1C26563; Tue, 8 Nov 2022 18:54:21 -0800 (PST) Received: by mail-pf1-f177.google.com with SMTP id k22so15485913pfd.3; Tue, 08 Nov 2022 18:54:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fyorhJCTSS6+0hPMlFzpEuVOTIRf/zjd/ug2ks95Ljg=; b=VH2QJB4mWw1oJX4ZZX5RCSix1QLp65AequtuiRgCqcmHhhpf2s5dtZdv81bvHLu4ag NbEeMLCXB9wvcavGrhfRTNhjJS2QEuCtcQATO63oqNOeObM+e6dYjWLfF1t9gKBxlt3Q AxdwN2GzxljwZIyA1FsNSAQxx9TVzdTP4l5ypCsmq8gcyFyqpcqA6lSkZ9QJvCoJlTqR CeNtybsHzh0ZCeO+f/uMQBhTcxeoWzmAaITzZqxsF0Lk6QuXvPoI632nUAf5j/Qe4yLr /UZHs6EEvSaUb35a/6hu/hXdnYBr/KA+xrW/NCyU2W25jfsWy1IVw/RZ/IGnhhWcNpQ8 Fd+A== X-Gm-Message-State: ACrzQf2DW8hJhtGDmWcyP9OGXL7LcapwNDcCwxhiOsW4mYNx4C7dQz92 c1d9JkFRjyMbr2EYtCmjBBc= X-Received: by 2002:a63:d60e:0:b0:46f:8979:30ba with SMTP id q14-20020a63d60e000000b0046f897930bamr47702265pgg.332.1667962460883; Tue, 08 Nov 2022 18:54:20 -0800 (PST) Received: from [172.20.3.206] (69-170-33-158.static-ip.telepacific.net. [69.170.33.158]) by smtp.gmail.com with ESMTPSA id ij26-20020a170902ab5a00b0017f6c9622b9sm7627594plb.183.2022.11.08.18.54.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Nov 2022 18:54:20 -0800 (PST) Message-ID: <65f5d26b-b0af-f9c6-e77c-e82ac969e9f9@grimberg.me> Date: Wed, 9 Nov 2022 04:54:18 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: nvme-pci: NULL pointer dereference in nvme_dev_disable() on linux-next Content-Language: en-US To: Christoph Hellwig , Gerd Bayer Cc: Jens Axboe , Niklas Schnelle , linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, linux-nvme@lists.infradead.org References: <20221108074846.GA22674@lst.de> From: Sagi Grimberg In-Reply-To: <20221108074846.GA22674@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no 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); > } Can we do that in the pci driver and not here?