]> err.no Git - linux-2.6/commitdiff
ide: fix ->io_32bit race in set_io_32bit()
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Wed, 12 Dec 2007 22:32:00 +0000 (23:32 +0100)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Wed, 12 Dec 2007 22:32:00 +0000 (23:32 +0100)
set_io_32bit() (ide_procset_t function) can race against running
PIO transfers.  Fix it by using ide_spin_wait_hwgroup().

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
drivers/ide/ide.c

index 85740ae5d6892eb95b95e6830ec4c169bb2b5b44..54943da6e4e5cfa45c80ac73a86f6c9de3a10769 100644 (file)
@@ -800,11 +800,17 @@ int set_io_32bit(ide_drive_t *drive, int arg)
        if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1))
                return -EINVAL;
 
+       if (ide_spin_wait_hwgroup(drive))
+               return -EBUSY;
+
        drive->io_32bit = arg;
 #ifdef CONFIG_BLK_DEV_DTC2278
        if (HWIF(drive)->chipset == ide_dtc2278)
                HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg;
 #endif /* CONFIG_BLK_DEV_DTC2278 */
+
+       spin_unlock_irq(&ide_lock);
+
        return 0;
 }