]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ide: fix locking in drive_release_dev()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 31 Mar 2009 18:15:25 +0000 (20:15 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Tue, 31 Mar 2009 18:15:25 +0000 (20:15 +0200)
* Request queue cleanup should happen before freeing drive->id
  and marking device as non-present.  Fix it.

* Remove superfluous hwif->lock acquiring/releasing.

Cc: Stanislaw Gruszka <stf_xl@wp.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide-probe.c

index 548864510ba9a88cf4af72042e317fe899f9f5ab..7c1f1bf818362da8689dc26efa55dfd00777d14c 100644 (file)
@@ -942,20 +942,16 @@ EXPORT_SYMBOL_GPL(ide_init_disk);
 static void drive_release_dev (struct device *dev)
 {
        ide_drive_t *drive = container_of(dev, ide_drive_t, gendev);
-       ide_hwif_t *hwif = drive->hwif;
 
        ide_proc_unregister_device(drive);
 
-       spin_lock_irq(&hwif->lock);
+       blk_cleanup_queue(drive->queue);
+       drive->queue = NULL;
+
        kfree(drive->id);
        drive->id = NULL;
+
        drive->dev_flags &= ~IDE_DFLAG_PRESENT;
-       /* Messed up locking ... */
-       spin_unlock_irq(&hwif->lock);
-       blk_cleanup_queue(drive->queue);
-       spin_lock_irq(&hwif->lock);
-       drive->queue = NULL;
-       spin_unlock_irq(&hwif->lock);
 
        complete(&drive->gendev_rel_comp);
 }