Commit 8bc68ca8 authored by Alan Cox's avatar Alan Cox Committed by Linus Torvalds

[PATCH] Make ide use proper removal-safe list handling (removes endless looping / hang)

Fix the IDE hang people see with 2.5.65-bk

From Dominik Brodowski <linux@brodo.de>
parent 9409259d
...@@ -2392,6 +2392,8 @@ static int ide_drive_remove(struct device * dev) ...@@ -2392,6 +2392,8 @@ static int ide_drive_remove(struct device * dev)
int ide_register_driver(ide_driver_t *driver) int ide_register_driver(ide_driver_t *driver)
{ {
struct list_head list; struct list_head list;
struct list_head *list_loop;
struct list_head *tmp_storage;
spin_lock(&drivers_lock); spin_lock(&drivers_lock);
list_add(&driver->drivers, &drivers); list_add(&driver->drivers, &drivers);
...@@ -2402,8 +2404,8 @@ int ide_register_driver(ide_driver_t *driver) ...@@ -2402,8 +2404,8 @@ int ide_register_driver(ide_driver_t *driver)
list_splice_init(&ata_unused, &list); list_splice_init(&ata_unused, &list);
spin_unlock(&drives_lock); spin_unlock(&drives_lock);
while (!list_empty(&list)) { list_for_each_safe(list_loop, tmp_storage, &list) {
ide_drive_t *drive = list_entry(list.next, ide_drive_t, list); ide_drive_t *drive = container_of(list_loop, ide_drive_t, list);
list_del_init(&drive->list); list_del_init(&drive->list);
if (drive->present) if (drive->present)
ata_attach(drive); ata_attach(drive);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment