ACPI: video: check for error while searching for backlight device parent
[ Upstream commit ccd45faf4973746c4f30ea41eec864e5cf191099 ]
If acpi_get_parent() called in acpi_video_dev_register_backlight()
fails, for example, because acpi_ut_acquire_mutex() fails inside
acpi_get_parent), this can lead to incorrect (uninitialized)
acpi_parent handle being passed to acpi_get_pci_dev() for detecting
the parent pci device.
Check acpi_get_parent() result and set parent device only in case of success.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 9661e92c10
("acpi: tie ACPI backlight devices to PCI devices if possible")
Signed-off-by: Nikita Kiryushin <kiryushin@ancud.ru>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
f5ea2cf3bb
commit
1e3a2b9b40
@ -1784,13 +1784,13 @@ static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
|
|||||||
return;
|
return;
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
acpi_get_parent(device->dev->handle, &acpi_parent);
|
if (ACPI_SUCCESS(acpi_get_parent(device->dev->handle, &acpi_parent))) {
|
||||||
|
|
||||||
pdev = acpi_get_pci_dev(acpi_parent);
|
pdev = acpi_get_pci_dev(acpi_parent);
|
||||||
if (pdev) {
|
if (pdev) {
|
||||||
parent = &pdev->dev;
|
parent = &pdev->dev;
|
||||||
pci_dev_put(pdev);
|
pci_dev_put(pdev);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
memset(&props, 0, sizeof(struct backlight_properties));
|
memset(&props, 0, sizeof(struct backlight_properties));
|
||||||
props.type = BACKLIGHT_FIRMWARE;
|
props.type = BACKLIGHT_FIRMWARE;
|
||||||
|
Loading…
Reference in New Issue
Block a user