ide: fix ->io_32bit race in set_io_32bit()

set_io_32bit() (ide_procset_t function) can race against running
PIO transfers.  Fix it by using ide_spin_wait_hwgroup().
Acked-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent bbe4d6d8
...@@ -800,11 +800,17 @@ int set_io_32bit(ide_drive_t *drive, int arg) ...@@ -800,11 +800,17 @@ int set_io_32bit(ide_drive_t *drive, int arg)
if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1)) if (arg < 0 || arg > 1 + (SUPPORT_VLB_SYNC << 1))
return -EINVAL; return -EINVAL;
if (ide_spin_wait_hwgroup(drive))
return -EBUSY;
drive->io_32bit = arg; drive->io_32bit = arg;
#ifdef CONFIG_BLK_DEV_DTC2278 #ifdef CONFIG_BLK_DEV_DTC2278
if (HWIF(drive)->chipset == ide_dtc2278) if (HWIF(drive)->chipset == ide_dtc2278)
HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg; HWIF(drive)->drives[!drive->select.b.unit].io_32bit = arg;
#endif /* CONFIG_BLK_DEV_DTC2278 */ #endif /* CONFIG_BLK_DEV_DTC2278 */
spin_unlock_irq(&ide_lock);
return 0; return 0;
} }
......
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