From: Kenji Kaneshige Date: Tue, 13 May 2008 07:48:50 +0000 (+0900) Subject: ACPI/PCI: another multiple _OSC memory leak fix X-Git-Tag: v2.6.26-rc3~70^2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c4e5fadd2a6fc0da465dcde761877d9a87313b33;p=linux-2.6 ACPI/PCI: another multiple _OSC memory leak fix The acpi_query_osc() function can be called for the ACPI object that doesn't have _OSC method. In this case, acpi_get_osc_data() would allocate a useless memory region. To avoid this, we need to check the existence of _OSC before calling acpi_get_osc_data() in acpi_query_osc(). Signed-off-by: Kenji Kaneshige Signed-off-by: Jesse Barnes --- diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 38fc8b1ff8..9d6fc8e628 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -60,9 +60,15 @@ acpi_query_osc ( union acpi_object *out_obj; u32 osc_dw0; acpi_status *ret_status = (acpi_status *)retval; - struct acpi_osc_data *osc_data = acpi_get_osc_data(handle); + struct acpi_osc_data *osc_data; u32 flags = (unsigned long)context, temp; + acpi_handle tmp; + status = acpi_get_handle(handle, "_OSC", &tmp); + if (ACPI_FAILURE(status)) + return status; + + osc_data = acpi_get_osc_data(handle); if (!osc_data) { printk(KERN_ERR "acpi osc data array is full\n"); return AE_ERROR;