diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:25 -0400 |
|---|---|---|
| committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-31 14:15:25 -0400 |
| commit | b5479167f4206e0d821a51ae149d921cd7a58e54 (patch) | |
| tree | 3303f6e1b4b42a08fec46123814d84ea339ccfcd | |
| parent | 4465461ece2b9249d6c0cf57bc0002100823e361 (diff) | |
ide: fix locking in drive_release_dev()
* 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>
| -rw-r--r-- | drivers/ide/ide-probe.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 548864510ba9..7c1f1bf81836 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
| @@ -942,20 +942,16 @@ EXPORT_SYMBOL_GPL(ide_init_disk); | |||
| 942 | static void drive_release_dev (struct device *dev) | 942 | static void drive_release_dev (struct device *dev) |
| 943 | { | 943 | { |
| 944 | ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); | 944 | ide_drive_t *drive = container_of(dev, ide_drive_t, gendev); |
| 945 | ide_hwif_t *hwif = drive->hwif; | ||
| 946 | 945 | ||
| 947 | ide_proc_unregister_device(drive); | 946 | ide_proc_unregister_device(drive); |
| 948 | 947 | ||
| 949 | spin_lock_irq(&hwif->lock); | 948 | blk_cleanup_queue(drive->queue); |
| 949 | drive->queue = NULL; | ||
| 950 | |||
| 950 | kfree(drive->id); | 951 | kfree(drive->id); |
| 951 | drive->id = NULL; | 952 | drive->id = NULL; |
| 953 | |||
| 952 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; | 954 | drive->dev_flags &= ~IDE_DFLAG_PRESENT; |
| 953 | /* Messed up locking ... */ | ||
| 954 | spin_unlock_irq(&hwif->lock); | ||
| 955 | blk_cleanup_queue(drive->queue); | ||
| 956 | spin_lock_irq(&hwif->lock); | ||
| 957 | drive->queue = NULL; | ||
| 958 | spin_unlock_irq(&hwif->lock); | ||
| 959 | 955 | ||
| 960 | complete(&drive->gendev_rel_comp); | 956 | complete(&drive->gendev_rel_comp); |
| 961 | } | 957 | } |
