diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-04-14 06:53:36 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-04-14 06:53:36 -0400 |
commit | 03aecbcd71f2d9b9a3bf422a880a1596fd585880 (patch) | |
tree | 56b39978f85621840c1827903c3f578445d0da8e /drivers/acpi | |
parent | 0fe0952b2191b19493adb847eb40c6f88e1caeaf (diff) | |
parent | 5f2e3274e527ec52413b43b5a9b30422eda4cdd2 (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.c | 6 |
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, | |||
247 | static struct acpi_device *acpi_companion_match(const struct device *dev) | 247 | static struct acpi_device *acpi_companion_match(const struct device *dev) |
248 | { | 248 | { |
249 | struct acpi_device *adev; | 249 | struct acpi_device *adev; |
250 | struct mutex *physical_node_lock; | ||
250 | 251 | ||
251 | adev = ACPI_COMPANION(dev); | 252 | adev = ACPI_COMPANION(dev); |
252 | if (!adev) | 253 | if (!adev) |
@@ -255,7 +256,8 @@ static struct acpi_device *acpi_companion_match(const struct device *dev) | |||
255 | if (list_empty(&adev->pnp.ids)) | 256 | if (list_empty(&adev->pnp.ids)) |
256 | return NULL; | 257 | return NULL; |
257 | 258 | ||
258 | mutex_lock(&adev->physical_node_lock); | 259 | physical_node_lock = &adev->physical_node_lock; |
260 | mutex_lock(physical_node_lock); | ||
259 | if (list_empty(&adev->physical_node_list)) { | 261 | if (list_empty(&adev->physical_node_list)) { |
260 | adev = NULL; | 262 | adev = NULL; |
261 | } else { | 263 | } else { |
@@ -266,7 +268,7 @@ static struct acpi_device *acpi_companion_match(const struct device *dev) | |||
266 | if (node->dev != dev) | 268 | if (node->dev != dev) |
267 | adev = NULL; | 269 | adev = NULL; |
268 | } | 270 | } |
269 | mutex_unlock(&adev->physical_node_lock); | 271 | mutex_unlock(physical_node_lock); |
270 | 272 | ||
271 | return adev; | 273 | return adev; |
272 | } | 274 | } |