Received: by 10.223.185.116 with SMTP id b49csp1064449wrg; Wed, 21 Feb 2018 11:27:19 -0800 (PST) X-Google-Smtp-Source: AH8x224VcBUyvqmBw7FcIvXD7wvZd1cOeP+yo71waFnIvv9EqP2lCn6d6D6kZzWLz3Tkqud6pJid X-Received: by 10.99.124.91 with SMTP id l27mr3477711pgn.298.1519241239659; Wed, 21 Feb 2018 11:27:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519241239; cv=none; d=google.com; s=arc-20160816; b=hJ3vbJdI/yoAJMdgpqBcvBWL/nX0Yx/yHNMoVsGfOYxqywAjrsjlQDYnLUAjRsw9LN uXXcQxNxJ0lHkzkKx8X2tCuf46e0qI8aXo5FeFAnGfKmBgeJmghmw1TLZ/TnTeFy4fSF 59oGjcy7Au5IV4BHFh0Ggzz0onRP1TdDEhdlrK1eEGeOL7GuBzIgq7nTlC51paZGtqJx duxY3iGz1ebJIvAlPSmtvMSQyVQ4oFVwCL1OmLiQjOQXx0KmTfWi9TGdu9pVyxjZb8y2 DYWYLNwoWJWIo9cICNKFgg4M/SvtTf4M5BUmRD0v4Kq6Er41MglzwtBUVGQ/G//QisKd J6nQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=a4/Q2e7hnBCvRR+vwG9zK+4Ae6P9If9CPEoC/EGmHvo=; b=DwvKAKW4OzO9JZPYxXQncf56exQ3p5gMy4az/7wsuIL92VcH1CS8LtKE9ZdisYMsrP uGRFnG6dIVmVtPX98TQHI5xiXnSVUZx2uH3giFqjU5JC72VaByjDBXf9dkxC4Oj4mmsy WEXzyTRlQFPgNWrLsi4Btj2pjMhoRLTusCj7cp9wIZDygahkWLQscIK7VbqpotjIy3Nb PyMBadyEt7OTA6gTmZNXf4/JMNVSw90+U+ntjAqgC7l9+f2uUuEx7YSu8DtFxdxdFQut BrHponAFOphIjUm0UQZvaTgVu1xu/amOseCIkNtOQbfLj76dgBI25v0u06PuBQiGC5lI qb/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=D8Z6A+6i; 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 19si3335702pfa.127.2018.02.21.11.27.04; Wed, 21 Feb 2018 11:27:19 -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=D8Z6A+6i; 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 S1751742AbeBUTYk (ORCPT + 99 others); Wed, 21 Feb 2018 14:24:40 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:38745 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751455AbeBUTYi (ORCPT ); Wed, 21 Feb 2018 14:24:38 -0500 Received: by mail-qt0-f195.google.com with SMTP id k13so3358468qtg.5; Wed, 21 Feb 2018 11:24:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=a4/Q2e7hnBCvRR+vwG9zK+4Ae6P9If9CPEoC/EGmHvo=; b=D8Z6A+6irn+M76oqT9ntypCjRiTjBqjUeSMr+UemmJHwoqpq22wPBO6ykW2/hw8u0t ajcOLW0crZueL89/lWlr9wtC9QzEMXYXhsMDcyRYPvMvGJOs05+N111ikhe32vowQWKF 6hz4qUYEHmxyzl35Nu03nEmIdrbKcAcor3FRVre75n57fKAYRZLwwgYDNs46QqXdykaj IkQKp3cldXuBQSAS7Y+MufmKu6q6zlkgsKqBvBWyJxWo2Z3ZdwhlEGpXHuWjxljsta4y BYzElv1QPdqFzH+6pF2SymhSOYViA3AyNudMEr/fFqNg5CG3ayYIV7OZYbLz5kONo1It tyEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=a4/Q2e7hnBCvRR+vwG9zK+4Ae6P9If9CPEoC/EGmHvo=; b=Yqb4QB1ChjKbhfAiCHTnjKbAxdn6Yj+dwfeA90kunfdugnjxA4WarBEOWaz13pq5tP ymDLsLLuJLwTv//z01kVYLcVG16n+5TPX8Ylo80XHQhhtHseAeQhWPjCNGYjighyVnBs DCoG0WW2oVipmD2IzoRTjSt51g1O245IzH5eMVrJZD0Hvz01tk8qQ5ZIP/7CzggkynSO DiUfdt/60gfhONl63ORM4lUngVDFSt30xn1A4Z6kbJu7lgTsKuuF+hyx4G1/jVvKD3tH bg2N/f1O2QiI7vC7ycNAbJAp22+Akmpd4CZ/slohEx4YnjRUpZ4A9y5Z0ecmFFZHD3Y3 LF9g== X-Gm-Message-State: APf1xPCXMdJ6S9Km0zHju0ipCwTuelX95j76CBF82WXoo80dazo2Uha0 0cJVbN2VUs7pC7sKpUZ57/kVKF7ZscCzA61nAIs= X-Received: by 10.200.39.217 with SMTP id x25mr6778402qtx.266.1519241077963; Wed, 21 Feb 2018 11:24:37 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Wed, 21 Feb 2018 11:24:37 -0800 (PST) In-Reply-To: <20180221090715.2853-1-christian.koenig@amd.com> References: <20180221090715.2853-1-christian.koenig@amd.com> From: Andy Shevchenko Date: Wed, 21 Feb 2018 21:24:37 +0200 Message-ID: Subject: Re: [PATCH] PCI: stop crashing in pci_release_resource v2 To: =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: Bjorn Helgaas , Linux Kernel Mailing List , linux-pci@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 11:07 AM, Christian K=C3=B6nig 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 > FWIW, Reviewed-by: Andy Shevchenko > Signed-off-by: Christian K=C3=B6nig > CC: stable@vger.kernel.org > --- > 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 r= esno) > struct resource *res =3D dev->resource + resno; > > dev_info(&dev->dev, "BAR %d: releasing %pR\n", resno, res); > + > + if (!res->parent) > + return; > + > release_resource(res); > res->end =3D resource_size(res) - 1; > res->start =3D 0; > -- > 2.14.1 > --=20 With Best Regards, Andy Shevchenko