From: Chuck Ebbert Date: Tue, 15 Apr 2008 21:34:47 +0000 (-0700) Subject: acpi: bus: check once more for an empty list after locking it X-Git-Tag: v2.6.25~8 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=f0a37e008750ead1751b7d5e89d220a260a46147;p=linux-2.6-omap-h63xx.git acpi: bus: check once more for an empty list after locking it 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 Cc: Cc: Len Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 5b6760e0f95..2d1955c1183 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -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)