Received: by 10.213.65.68 with SMTP id h4csp186264imn; Tue, 20 Mar 2018 00:24:12 -0700 (PDT) X-Google-Smtp-Source: AG47ELs6IlC5LNextqP8elFvkBYwcjKrZIxM/on/zobPO43B7CaB0CC6kQnMchpIufdSy/lLXsdX X-Received: by 2002:a17:902:5409:: with SMTP id d9-v6mr3364969pli.176.1521530652657; Tue, 20 Mar 2018 00:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521530652; cv=none; d=google.com; s=arc-20160816; b=NLawOgXrCwzEvhLTWE2BFZqyfvPOheAVCZn3lN8MvYw+CnpW2mM+RMBj7CtMFduwHM jJtTTCnxUSqlmNVf8l2s9LZt2NDyx3oqwdskBbNWxcxyMBRxCLrEkzAMu8M4EK7jNvUG 82Sl7X1XK2gkqoe1+1d1VxemUffC/eCgtiZCIimdiFCZMHBL25gjcqJ33MuCcApXLt81 xDBtqrv99zExrXUM+/+5Adfvhk0W9CmgqXc4QxoUkKzfqdgIBgPrw5SzPFnL+RmvcZBB FhYO2lDnRzinKB1qeZWpV4oXM/j9c82gtgyEfbDHcDln5mOAZ/QuMYA/5R6LPI6esk7e SUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=H+yX4ZTBPzlh1o2d+7lzTVUCux0TzGWvMOMOZS958vg=; b=KYIeUNU1uAzS6PHCPQMAQ18FsqGCiZ0Ss38Ass4/iMskGll1kSCx2iWHfKUprD/M8W rUbn3eN+Ov12RjoFoMbgxgCEmKYzFwJI21VgKKJKFt8vuB+Tt0XLLMwIlgPyOJ6genF5 ZhDHQq6M7xdTFA+EkuMvlqDf7u+N2RXS/8ryfm7Dsf78ylU8cNvESCSxzxUk/h5/0MjC y/7DfhW0u2bfpCRnscdCWZ99M/YV6QLeE3vcOdKNSSxmxgli02+MDVoCZYhXXnFLXKiK LRM1Z3bzmLlJV8uTBKbocBxe1f29w59Jqv8PZ3e3L3RhgppmoE3f+aN1elAgDDgaZJxv 61Uw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 126si461104pgc.766.2018.03.20.00.23.58; Tue, 20 Mar 2018 00:24:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751572AbeCTHW6 (ORCPT + 99 others); Tue, 20 Mar 2018 03:22:58 -0400 Received: from verein.lst.de ([213.95.11.211]:35747 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751308AbeCTHW5 (ORCPT ); Tue, 20 Mar 2018 03:22:57 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id 91452DE401; Tue, 20 Mar 2018 08:22:55 +0100 (CET) Date: Tue, 20 Mar 2018 08:22:55 +0100 From: Christoph Hellwig To: Michael Neuling Cc: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH] nvme-pci: Fix NULL ptr deref in EEH code Message-ID: <20180320072255.GA15059@lst.de> References: <20180320002242.10416-1-mikey@neuling.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180320002242.10416-1-mikey@neuling.org> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 20, 2018 at 11:22:42AM +1100, Michael Neuling wrote: > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index b6f43b738f..404b346e3c 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -2626,6 +2626,9 @@ static pci_ers_result_t nvme_error_detected(struct pci_dev *pdev, > { > struct nvme_dev *dev = pci_get_drvdata(pdev); > > + if (!dev) > + return PCI_ERS_RESULT_NEED_RESET; This implies the method has been called before ->probe has been finished or after ->remove has been called. That would be fundamentally racy and needs to be fixed in the PCI layer, not papered over in drivers.