Received: by 10.223.185.116 with SMTP id b49csp7773637wrg; Thu, 1 Mar 2018 10:51:16 -0800 (PST) X-Google-Smtp-Source: AG47ELvpubykWxNAXH6unZN0xMo3iQWBBggYfR6Ek5F/ttcC19viFwApYjrKYjxH+rFV7o41SLs4 X-Received: by 2002:a17:902:3283:: with SMTP id z3-v6mr2881522plb.118.1519930276271; Thu, 01 Mar 2018 10:51:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519930276; cv=none; d=google.com; s=arc-20160816; b=uWZr/R6eNR3Xfy81fqX78gU30AMFxgaXQhwRHmoizca0rEFdCetqYgnyj4Eh7UA7U9 Pmi9jms0oZ0y9DvXn+ml9rLvGXGnxu2gG+TQhK97+t+MkYVet8ZfH8UGP4tl39w/CIUy TUPPt+gE1uKAdF05no4dy4/bJlGPQhWLUsx7Z1g2sjIS8/vSoHZbygVZsO9GT7mziZZZ /VVvcSSuJpgL4XSZyGqzEUoCw9VQUbv2fUgWw52XyjRvFOonCZgJRCDwbjfjGBADGWIS bKtjqfG4bNbquTgGTub7w6FK9NEeo1UMXJk6Rc8Ca8OJPjl0UzTX3yvowO9t0IkAN+fC E22A== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dmarc-filter :arc-authentication-results; bh=UvTVec6gCiE4Q541Plj6W97Pqg7f13rJkGZecTD6YEg=; b=SMb5kq5H2Rn3ySzckDob9asMTg7u8YGqclkimEJiWvOkmQ/ZlDBFRsqPFIhgBrMtt6 myI0kBv1WKFa+LEuTPO4xQJ2QVmZLcQTjXtp2i20BMjVPdBVf8x6Fk3aRee1GOKn35UK ip4Kyx6u3pdMehIB2H8NVo7T3AVNGAD42NAcPzgVemMa9F4ZZ+1LNMlR0WJtPDEl0vL6 +u1dV5xysfYEoMEkS6XOX6NTu3Ltl9gCODiytrVoVd+I5viv6BJEd5w/otTpz10He/wJ lykzpPo7YriRbzmO/ioBnEKM9tokhBRKS+GQ7dq/4Bl7GTe/sk/V3SY7w/ChaDM+uTcI l+2w== 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 v6si3379944pfa.116.2018.03.01.10.51.01; Thu, 01 Mar 2018 10:51:16 -0800 (PST) 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 S1161043AbeCASuG (ORCPT + 99 others); Thu, 1 Mar 2018 13:50:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:58400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034023AbeCASuC (ORCPT ); Thu, 1 Mar 2018 13:50:02 -0500 Received: from localhost (50-81-63-165.client.mchsi.com [50.81.63.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9FBCF21771; Thu, 1 Mar 2018 18:50:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9FBCF21771 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Thu, 1 Mar 2018 12:49:57 -0600 From: Bjorn Helgaas To: Christian =?iso-8859-1?Q?K=F6nig?= Cc: bhelgaas@google.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH] PCI: stop crashing in pci_release_resource v2 Message-ID: <20180301184957.GI13722@bhelgaas-glaptop.roam.corp.google.com> References: <20180221090715.2853-1-christian.koenig@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180221090715.2853-1-christian.koenig@amd.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 21, 2018 at 10:07:15AM +0100, Christian K?nig wrote: > Is it entirely possible that the BIOS wasn't able to assign resources to > a device. In this case don't crash in pci_release_resource() when we try > to resize the resource. > > v2: keep printing the info that we try to release the BAR > > Signed-off-by: Christian K?nig > CC: stable@vger.kernel.org I was hoping for a dmesg snippet, but I added a Fixes: tag and applied this to for-linus for v4.16. > --- > drivers/pci/setup-res.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c > index e815111f3f81..c0f091614805 100644 > --- a/drivers/pci/setup-res.c > +++ b/drivers/pci/setup-res.c > @@ -402,6 +402,10 @@ void pci_release_resource(struct pci_dev *dev, int resno) > struct resource *res = dev->resource + resno; > > dev_info(&dev->dev, "BAR %d: releasing %pR\n", resno, res); > + > + if (!res->parent) > + return; > + > release_resource(res); > res->end = resource_size(res) - 1; > res->start = 0; > -- > 2.14.1 >