Commit c37406e0 authored by Christian König's avatar Christian König Committed by Bjorn Helgaas

PCI: Allow release of resources that were never assigned

It is 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.

Fixes: 8bb705e3 ("PCI: Add pci_resize_resource() for resizing BARs")
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
CC: stable@vger.kernel.org	# v4.15+
parent 6d516d67
...@@ -401,6 +401,10 @@ void pci_release_resource(struct pci_dev *dev, int resno) ...@@ -401,6 +401,10 @@ void pci_release_resource(struct pci_dev *dev, int resno)
struct resource *res = dev->resource + resno; struct resource *res = dev->resource + resno;
pci_info(dev, "BAR %d: releasing %pR\n", resno, res); pci_info(dev, "BAR %d: releasing %pR\n", resno, res);
if (!res->parent)
return;
release_resource(res); release_resource(res);
res->end = resource_size(res) - 1; res->end = resource_size(res) - 1;
res->start = 0; res->start = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment