Skip to content

Commit 830380e

Browse files
committed
Merge tag 'acpi-6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull ACPI fix from Rafael Wysocki: "Fix a possible NULL pointer dereference in the error path of acpi_video_bus_add() resulting from recent changes (Dinghao Liu)" * tag 'acpi-6.6-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI: video: Fix NULL pointer dereference in acpi_video_bus_add()
2 parents 1c9d831 + f4dcf06 commit 830380e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/acpi/acpi_video.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2057,7 +2057,9 @@ static int acpi_video_bus_add(struct acpi_device *device)
20572057
!auto_detect)
20582058
acpi_video_bus_register_backlight(video);
20592059

2060-
acpi_video_bus_add_notify_handler(video);
2060+
error = acpi_video_bus_add_notify_handler(video);
2061+
if (error)
2062+
goto err_del;
20612063

20622064
error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
20632065
acpi_video_bus_notify);
@@ -2067,10 +2069,11 @@ static int acpi_video_bus_add(struct acpi_device *device)
20672069
return 0;
20682070

20692071
err_remove:
2072+
acpi_video_bus_remove_notify_handler(video);
2073+
err_del:
20702074
mutex_lock(&video_list_lock);
20712075
list_del(&video->entry);
20722076
mutex_unlock(&video_list_lock);
2073-
acpi_video_bus_remove_notify_handler(video);
20742077
acpi_video_bus_unregister_backlight(video);
20752078
err_put_video:
20762079
acpi_video_bus_put_devices(video);

0 commit comments

Comments
 (0)