Received: by 10.223.185.116 with SMTP id b49csp8550755wrg; Fri, 2 Mar 2018 03:58:47 -0800 (PST) X-Google-Smtp-Source: AG47ELvBXJpaFv0hVh7vSGOG11tCAm98cdsDQ8ZNLTHFqB/5DaSXIqnj6mekb4SQYO4ZhJMeUgP/ X-Received: by 10.98.10.65 with SMTP id s62mr5431268pfi.234.1519991927268; Fri, 02 Mar 2018 03:58:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519991927; cv=none; d=google.com; s=arc-20160816; b=ncMNimxArStmdy22ttqeoevj0E010iF8n9w48ZWB13VIuKCFHgQvvuv6uuGcj1D99R lL5ifX/MEJUdRIldn17JPvnNzh+qmsaAdaHw298zEOxHTiyNodAiuI2N9EmGX5ieuauw mGDHs3BhjAjzs5UvdpD8O8qJp+fHT685r8NKdOpvycNo8wNr2yCSTVenUYKbICYbg1Xz P/4Gsq8MsZQO/6s/ThoC8t9LOJYgVJTe26OoPUrAjGdtD7509FVl9GSNR03noS1E+Ai5 DeDkxJovmcAFx20LwqNziVltEeetwDvPTKyxs3QO0U9/lrKEEgBhM4+EXGjSauTtua22 1qgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:reply-to:dkim-signature :arc-authentication-results; bh=dSIRx+b0p/IlOPdhq99BnUIsuSB9oQiRNJ4KifkY4EA=; b=hL5wVkYNQoHLIxL3MT9KM0UYHLyKFUMdCq9qv6YWSkL8BF3Vli4yI4g5tZHRKdV30/ zUgjV+9A1utgnunhc51oo0LUp2mhxa6+z5SjvTcr+WBdX9o9rHd702LhrhXefBlyFfc7 gXJiF4mibFGWbfp/6/Fz+h+MzQIqKxeI0yB0rO91ufTR9oJogAmEtQXNvWoaccVfr+S+ urLVwBkx9nCgmpRH7ortEyaUoEQ9P2YZ90TlolQ7jxBc+FIgx+9ZvhO2+5JXN+LYiolk KZHMWPNHlH+5OhEPGzqnloYNANDpgFIWjLf/vjKCj6OdCfJ6AdpNnxb/q67mBRLmZSf/ WT/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u4MhuGrM; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 26si4680287pfl.261.2018.03.02.03.58.31; Fri, 02 Mar 2018 03:58:47 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=u4MhuGrM; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034303AbeCBHzI (ORCPT + 99 others); Fri, 2 Mar 2018 02:55:08 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53094 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034261AbeCBHzG (ORCPT ); Fri, 2 Mar 2018 02:55:06 -0500 Received: by mail-wm0-f68.google.com with SMTP id t3so1402692wmc.2; Thu, 01 Mar 2018 23:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=reply-to:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=dSIRx+b0p/IlOPdhq99BnUIsuSB9oQiRNJ4KifkY4EA=; b=u4MhuGrM72J9+IvhoI9axGGrOgNxclnDMq9x4OJnAhmLgMWQyZ6Tb0MVZRbocDu47c 7ZP2Ky3Nh9kFzmLcFbppAt5QuaTj0cHmSHQcUA7HZNFD1FQTd5rFtcyXA4Wb8p/TIQP2 yZGUZbgSZHHzmiLwQK2dSuKVNVbuD1/KvH2A4Np3hw0JtYfIuva6jaZ+SC5H5JPLXEn5 tBk6BVqnZg8EfbeQMrfNoHrF/QvjiMLfnSbIjCDDO6akqV97gT/v0PwJyLD6ZnG2A6q0 4aYMPF6orph7hRmaqYO92nED5U7nTyN8/AxRJUMrnE/oOBvf52iYFbIYh/JhLulAR+3j KaBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=dSIRx+b0p/IlOPdhq99BnUIsuSB9oQiRNJ4KifkY4EA=; b=hfZez18/3yrjeddAo22TsW5To7BQqWI7vEl5xoUeDHkC3fPU9LeZm84D+tLAkEDWcB UZrIhZMweX51GAVv+O255SR5nkgBgD08nsUY30Hjx8IHiqtbOu8UTgbNmfIaFLcjTdB9 /C96W4QIKIUkd54UoCU+/VeN8nJ0pf4Rd+eub58cGp878CGT835MZAKFsREC+/sLqGp4 WJLLBj5pjcHx7mpOZ5YVjgebVDLOBHMckXcMudPpnQxAoj0OBzt7CjHN0rI+mCF2NlzD ESIks4yNYXdVK7wz3VOBtEQFsV8uKr4/iH4VnWwT1GzzCBnD4rrvnhGnQ33fU26ViVMx +SFA== X-Gm-Message-State: AElRT7FofNSTI0gX2ZaAfG3JvuXXA0aIwQIpEQ28MHC3SosTJatvp2Xx g5X0yeCNMDJRSxyms9MXZkEXO9Ss X-Received: by 10.28.241.15 with SMTP id p15mr689812wmh.42.1519977304878; Thu, 01 Mar 2018 23:55:04 -0800 (PST) Received: from ?IPv6:2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88? ([2a02:908:1251:8fc0:4c6d:7233:b7e1:3b88]) by smtp.gmail.com with ESMTPSA id r126sm680072wmd.29.2018.03.01.23.55.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Mar 2018 23:55:04 -0800 (PST) Reply-To: christian.koenig@amd.com Subject: Re: [PATCH] PCI: stop crashing in pci_release_resource v2 To: Bjorn Helgaas Cc: bhelgaas@google.com, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org References: <20180221090715.2853-1-christian.koenig@amd.com> <20180301184957.GI13722@bhelgaas-glaptop.roam.corp.google.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= Message-ID: Date: Fri, 2 Mar 2018 08:55:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180301184957.GI13722@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 01.03.2018 um 19:49 schrieb Bjorn Helgaas: > 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. Sorry, been on vacation and missed your mail. I don't have a dmesg of hand either, cause the reporter provided only a mail with a picture of the crash :) But he confirmed that the patch worked. Thanks, Christian. > >> --- >> 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 >>