]> www.infradead.org Git - users/dwmw2/linux.git/commit
PCI: Allow pci_resize_resource() for devices on root bus
authorArd Biesheuvel <ardb@kernel.org>
Tue, 21 Apr 2020 16:22:56 +0000 (18:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:48:20 +0000 (17:48 +0200)
commit5294d139bd5f17eaecee1d0252764ac6d26edcc8
tree0becd726c817aa58d3488679a5971da796bcddc8
parent9ab21eb86cc0e411876cf28d5a1b93f6cbdeb29c
PCI: Allow pci_resize_resource() for devices on root bus

[ Upstream commit d09ddd8190fbdc07696bf34b548ae15aa1816714 ]

When resizing a BAR, pci_reassign_bridge_resources() is invoked to bring
the bridge windows of parent bridges in line with the new BAR assignment.

This assumes the device whose BAR is being resized lives on a subordinate
bus, but this is not necessarily the case. A device may live on the root
bus, in which case dev->bus->self is NULL, and passing a NULL pci_dev
pointer to pci_reassign_bridge_resources() will cause it to crash.

So let's make the call to pci_reassign_bridge_resources() conditional on
whether dev->bus->self is non-NULL in the first place.

Fixes: 8bb705e3e79d84e7 ("PCI: Add pci_resize_resource() for resizing BARs")
Link: https://lore.kernel.org/r/20200421162256.26887-1-ardb@kernel.org
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/setup-res.c