Skip to content

Commit 03aecbc

Browse files
committed
Merge branch 'acpi-scan'
* acpi-scan: ACPI / scan: Fix NULL pointer dereference in acpi_companion_match()
2 parents 0fe0952 + 5f2e327 commit 03aecbc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/acpi/scan.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ static int create_of_modalias(struct acpi_device *acpi_dev, char *modalias,
247247
static struct acpi_device *acpi_companion_match(const struct device *dev)
248248
{
249249
struct acpi_device *adev;
250+
struct mutex *physical_node_lock;
250251

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

258-
mutex_lock(&adev->physical_node_lock);
259+
physical_node_lock = &adev->physical_node_lock;
260+
mutex_lock(physical_node_lock);
259261
if (list_empty(&adev->physical_node_list)) {
260262
adev = NULL;
261263
} else {
@@ -266,7 +268,7 @@ static struct acpi_device *acpi_companion_match(const struct device *dev)
266268
if (node->dev != dev)
267269
adev = NULL;
268270
}
269-
mutex_unlock(&adev->physical_node_lock);
271+
mutex_unlock(physical_node_lock);
270272

271273
return adev;
272274
}

0 commit comments

Comments
 (0)