diff mbox

[v4,13/52] PCI, acpiphp: Add missing realloc list checking after resource allocation

Message ID 1440138067-4314-14-git-send-email-yinghai@kernel.org
State Changes Requested
Headers show

Commit Message

Yinghai Lu Aug. 21, 2015, 6:20 a.m. UTC
We check the realloc list, as list must be empty after allocation.

Add missing one acpiphp driver.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org
---
 drivers/pci/hotplug/acpiphp_glue.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Rafael J. Wysocki Aug. 24, 2015, 10:09 p.m. UTC | #1
On Thursday, August 20, 2015 11:20:28 PM Yinghai Lu wrote:
> We check the realloc list, as list must be empty after allocation.
> 
> Add missing one acpiphp driver.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: linux-acpi@vger.kernel.org
> ---
>  drivers/pci/hotplug/acpiphp_glue.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> index ff53856..1c7c1d7 100644
> --- a/drivers/pci/hotplug/acpiphp_glue.c
> +++ b/drivers/pci/hotplug/acpiphp_glue.c
> @@ -507,6 +507,7 @@ static void enable_slot(struct acpiphp_slot *slot)
>  		}
>  	}
>  	__pci_bus_assign_resources(bus, &add_list, NULL);
> +	BUG_ON(!list_empty(&add_list));

Is crashing the kernel the best we can do here?

What about bailing out with a WARN_ON() instead?  Surely, the kernel can work
without the new device?

>  
>  	acpiphp_sanitize_bus(bus);
>  	pcie_bus_configure_settings(bus);
>
diff mbox

Patch

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index ff53856..1c7c1d7 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -507,6 +507,7 @@  static void enable_slot(struct acpiphp_slot *slot)
 		}
 	}
 	__pci_bus_assign_resources(bus, &add_list, NULL);
+	BUG_ON(!list_empty(&add_list));
 
 	acpiphp_sanitize_bus(bus);
 	pcie_bus_configure_settings(bus);