Skip to content

Commit

Permalink
acpi: bus: check once more for an empty list after locking it
Browse files Browse the repository at this point in the history
List could have become empty after the unlocked check that was made earlier,
so check again inside the lock.

Should fix https://bugzilla.redhat.com/show_bug.cgi?id=427765

Signed-off-by: Chuck Ebbert <cebbert@redhat.com>
Cc: <stable@kernel.org>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Chuck Ebbert authored and Linus Torvalds committed Apr 16, 2008
1 parent d1e7780 commit f0a37e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/acpi/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,11 @@ int acpi_bus_receive_event(struct acpi_bus_event *event)
}

spin_lock_irqsave(&acpi_bus_event_lock, flags);
entry =
list_entry(acpi_bus_event_list.next, struct acpi_bus_event, node);
if (entry)
if (!list_empty(&acpi_bus_event_list)) {
entry = list_entry(acpi_bus_event_list.next,
struct acpi_bus_event, node);
list_del(&entry->node);
}
spin_unlock_irqrestore(&acpi_bus_event_lock, flags);

if (!entry)
Expand Down

0 comments on commit f0a37e0

Please sign in to comment.