aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-18 18:44:45 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-06-19 18:47:55 -0400
commit6ee22e9d59151550a55d370b14109bdae8b58bda (patch)
treea696cfa46f84f84cf38c44f8212d32f2f940063a /drivers/acpi
parent8112006f41fd76ddf4988f8ddd904563db85613c (diff)
ACPI / PM: Fix error code path for power resources initialization
Commit 781d737 (ACPI: Drop power resources driver) introduced a bug in the power resources initialization error code path causing a NULL pointer to be referenced in acpi_release_power_resource() if there's an error triggering a jump to the 'err' label in acpi_add_power_resource(). This happens because the list_node field of struct acpi_power_resource has not been initialized yet at this point and doing a list_del() on it is a bad idea. To prevent this problem from occuring, initialize the list_node field of struct acpi_power_resource upfront. Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com> Tested-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: 3.9+ <stable@vger.kernel.org> Acked-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/power.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index f962047c6c85..288bb270f8ed 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -885,6 +885,7 @@ int acpi_add_power_resource(acpi_handle handle)
885 ACPI_STA_DEFAULT); 885 ACPI_STA_DEFAULT);
886 mutex_init(&resource->resource_lock); 886 mutex_init(&resource->resource_lock);
887 INIT_LIST_HEAD(&resource->dependent); 887 INIT_LIST_HEAD(&resource->dependent);
888 INIT_LIST_HEAD(&resource->list_node);
888 resource->name = device->pnp.bus_id; 889 resource->name = device->pnp.bus_id;
889 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME); 890 strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
890 strcpy(acpi_device_class(device), ACPI_POWER_CLASS); 891 strcpy(acpi_device_class(device), ACPI_POWER_CLASS);