[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcmvgSjC2BqxVBPO26xicVUOQ0UDU7=3QMo81917pW4hQ@mail.gmail.com>
Date:   Wed, 21 Feb 2018 21:24:37 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Christian König <ckoenig.leichtzumerken@...il.com>
Cc:     Bjorn Helgaas <bhelgaas@...gle.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-pci@...r.kernel.org
Subject: Re: [PATCH] PCI: stop crashing in pci_release_resource v2
On Wed, Feb 21, 2018 at 11:07 AM, Christian König
<ckoenig.leichtzumerken@...il.com> 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 <andy.shevchenko@...il.com>
> Signed-off-by: Christian König <christian.koenig@....com>
> CC: stable@...r.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 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
>
-- 
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists
 
