Commit
e1acdeb0e770 "ACPI / scan: Simplify acpi_match_device()"
introduced code that may lead to a NULL pointer dereference when
trying to unlock a mutex. Fix that.
Fixes:
e1acdeb0e770 "ACPI / scan: Simplify acpi_match_device()"
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
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)
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 {
if (node->dev != dev)
adev = NULL;
}
- mutex_unlock(&adev->physical_node_lock);
+ mutex_unlock(physical_node_lock);
return adev;
}