Received: by 10.223.185.116 with SMTP id b49csp4194574wrg; Mon, 26 Feb 2018 12:58:50 -0800 (PST) X-Google-Smtp-Source: AG47ELugm2I5X/WvrFcBqOXu/XoGlulXClh6vBeSH+GwRGcvUCA5PspW8hhl/GYidGLPUr4R/gba X-Received: by 10.101.76.134 with SMTP id m6mr982204pgt.445.1519678730833; Mon, 26 Feb 2018 12:58:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519678730; cv=none; d=google.com; s=arc-20160816; b=YZ7dy7B5QnqLyWEv2b/RnC6dnHffQgD47fv+SKTD6hwYo1DYTOK/evprd013XGvo2x aIlBiBGol7/SIaNRfERoneWQxIu79LSCO4vmKTvRgvD6MYf4Z3J/Gy54o7OsZDlXVyzv +4ZXyT4ZCABZFMukDI815D57qcawFQod4jpq7RwUZdplSZnwVJBr9GJggXPfmDiiAYlH ks9xLdDBlJBeinQ1qHPywXD5aJlHkFmZB/WNojAX5VsRf1jp9gSBpKeYvukPtUknLuoW E/nwY/3V7sYIp3U5IsP/8eNh2tLpjLN7RpcmWbiTXidgB1vcn6Q12Wqx2cDykQiyHNdO B/+A== 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=Hr4kFyQFroqbohcF0tgnSZa5/JifbZgNFmGoWJWa00A=; b=NkRYHy+vp/qN9KvPFhUPS2d6Y3WLrDDW4/vinvokyhaBDrrIIc/xyhLSLEo0BU16CU WliszPmY0PzAchTZG/9rCc2GTO2H5/RYqTgne8RcA30MIBz0eExlDUu+xsfjgirNdkoO PtNJjEhim6yiDUokRanmXftwhWk+25G306cVtuKV7BOf5MYj9XGWWHOVlZbShnEKfJRO hEsnd4Fcr/qZCGtbw0X2oF3R1ninnCqz7Uq/nSEGu8EFho8k6kzMrpf2uYJB0QYqt3rX oSgWk7pQM1aIZt/KI+yrPuDsOy2HeFZIueZPIJ1LrABVY1ZMFN7cHG2u/+4CpKOLOvF0 ltQw== 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 64-v6si7183432plk.152.2018.02.26.12.58.34; Mon, 26 Feb 2018 12:58:50 -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 S1752676AbeBZU4g (ORCPT + 99 others); Mon, 26 Feb 2018 15:56:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:45832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752156AbeBZU4e (ORCPT ); Mon, 26 Feb 2018 15:56:34 -0500 Received: from localhost (unknown [69.55.156.246]) (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 6436C2168C; Mon, 26 Feb 2018 20:56:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6436C2168C 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: Mon, 26 Feb 2018 14:56:32 -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: <20180226205632.GB63171@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 think we probably want this in v4.16, since it seems to be a fix for 8bb705e3e79d ("PCI: Add pci_resize_resource() for resizing BARs"), which appeared in v4.15. What does the crash look like? I might include a few lines in the changelog to help people find the fix. I added a Fixes: tag and Andy's Reviewed-by already. > --- > 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 >