Skip to content

Commit

Permalink
ACPI/PCI: another multiple _OSC memory leak fix
Browse files Browse the repository at this point in the history
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 <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
  • Loading branch information
Kenji Kaneshige authored and Jesse Barnes committed May 13, 2008
1 parent 77db988 commit c4e5fad
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/pci/pci-acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c4e5fad

Please sign in to comment.