Skip to content

Commit

Permalink
Merge branch 'acpi-scan'
Browse files Browse the repository at this point in the history
* acpi-scan:
  ACPI / scan: Fix NULL pointer dereference in acpi_companion_match()
  • Loading branch information
Rafael J. Wysocki committed Apr 14, 2015
2 parents 0fe0952 + 5f2e327 commit 03aecbc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/acpi/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,
static struct acpi_device *acpi_companion_match(const struct device *dev)
{
struct acpi_device *adev;
struct mutex *physical_node_lock;

adev = ACPI_COMPANION(dev);
if (!adev)
Expand All @@ -255,7 +256,8 @@ static struct acpi_device *acpi_companion_match(const struct device *dev)
if (list_empty(&adev->pnp.ids))
return NULL;

mutex_lock(&adev->physical_node_lock);
physical_node_lock = &adev->physical_node_lock;
mutex_lock(physical_node_lock);
if (list_empty(&adev->physical_node_list)) {
adev = NULL;
} else {
Expand All @@ -266,7 +268,7 @@ static struct acpi_device *acpi_companion_match(const struct device *dev)
if (node->dev != dev)
adev = NULL;
}
mutex_unlock(&adev->physical_node_lock);
mutex_unlock(physical_node_lock);

return adev;
}
Expand Down

0 comments on commit 03aecbc

Please sign in to comment.