aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorRafael J. Wysocki2015-04-14 12:53:36 +0200
committerRafael J. Wysocki2015-04-14 12:53:36 +0200
commit03aecbcd71f2d9b9a3bf422a880a1596fd585880 (patch)
tree56b39978f85621840c1827903c3f578445d0da8e /drivers/acpi
parent0fe0952b2191b19493adb847eb40c6f88e1caeaf (diff)
parent5f2e3274e527ec52413b43b5a9b30422eda4cdd2 (diff)
Merge branch 'acpi-scan'
* acpi-scan: ACPI / scan: Fix NULL pointer dereference in acpi_companion_match()
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/scan.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index d2e3c3e3f9c9..69bc0d888c01 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -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)
@@ -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 {
@@ -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;
}