Skip to content

Commit

Permalink
ACPI: video: Remove acpi_video_bus from list before tearing it down
Browse files Browse the repository at this point in the history
Move the list_del removing an acpi_video_bus from video_bus_head
on teardown to before the teardown is done, to avoid code iterating
over the video_bus_head list seeing acpi_video_bus objects on there
which are (partly) torn down already.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Hans de Goede committed Sep 2, 2022
1 parent a2fc3c8 commit c1af8be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -2111,14 +2111,14 @@ static int acpi_video_bus_remove(struct acpi_device *device)

video = acpi_driver_data(device);

acpi_video_bus_remove_notify_handler(video);
acpi_video_bus_unregister_backlight(video);
acpi_video_bus_put_devices(video);

mutex_lock(&video_list_lock);
list_del(&video->entry);
mutex_unlock(&video_list_lock);

acpi_video_bus_remove_notify_handler(video);
acpi_video_bus_unregister_backlight(video);
acpi_video_bus_put_devices(video);

kfree(video->attached_array);
kfree(video);

Expand Down

0 comments on commit c1af8be

Please sign in to comment.