public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [PATCH] ACPI / PM: Fix error code path for power resources initialization
Date: Wed, 19 Jun 2013 10:29:56 +0300	[thread overview]
Message-ID: <20130619072956.GE11878@intel.com> (raw)
In-Reply-To: <8547354.D2OPcUytEB@vostro.rjw.lan>

On Tue, Jun 18, 2013 at 12:37:45AM +0200, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>

> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: 3.9+ <stable@vger.kernel.org>
> ---
>  drivers/acpi/power.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> Index: linux-pm/drivers/acpi/power.c
> ===================================================================
> --- linux-pm.orig/drivers/acpi/power.c
> +++ linux-pm/drivers/acpi/power.c
> @@ -882,6 +882,7 @@ int acpi_add_power_resource(acpi_handle
>  				ACPI_STA_DEFAULT);
>  	mutex_init(&resource->resource_lock);
>  	INIT_LIST_HEAD(&resource->dependent);
> +	INIT_LIST_HEAD(&resource->list_node);
>  	resource->name = device->pnp.bus_id;
>  	strcpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
>  	strcpy(acpi_device_class(device), ACPI_POWER_CLASS);

      parent reply	other threads:[~2013-06-19  7:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-17 22:37 [PATCH] ACPI / PM: Fix error code path for power resources initialization Rafael J. Wysocki
2013-06-19  4:45 ` Yasuaki Ishimatsu
2013-06-19  7:29 ` Mika Westerberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130619072956.GE11878@intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox