ide: fix races in handling of user-space SET XFER commands
* Make cmd->tf_flags field 'u16' and add IDE_TFLAG_SET_XFER taskfile flag. * Update ide_finish_cmd() to set xfer / re-read id if the new flag is set. * Convert set_xfer_rate() (write handler for /proc/ide/hd?/current_speed) and ide_cmd_ioctl() (HDIO_DRIVE_CMD ioctl handler) to use the new flag. * Remove no longer needed disable_irq_nosync() + enable_irq() from ide_config_drive_speed(). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
fa56d4cb40
commit
665d66e8fa
@ -195,7 +195,6 @@ ide_devset_get(xfer_rate, current_speed);
|
||||
static int set_xfer_rate (ide_drive_t *drive, int arg)
|
||||
{
|
||||
struct ide_cmd cmd;
|
||||
int err;
|
||||
|
||||
if (arg < XFER_PIO_0 || arg > XFER_UDMA_6)
|
||||
return -EINVAL;
|
||||
@ -206,14 +205,9 @@ static int set_xfer_rate (ide_drive_t *drive, int arg)
|
||||
cmd.tf.nsect = (u8)arg;
|
||||
cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT;
|
||||
cmd.valid.in.tf = IDE_VALID_NSECT;
|
||||
cmd.tf_flags = IDE_TFLAG_SET_XFER;
|
||||
|
||||
err = ide_no_data_taskfile(drive, &cmd);
|
||||
|
||||
if (!err) {
|
||||
ide_set_xfer_rate(drive, (u8) arg);
|
||||
ide_driveid_update(drive);
|
||||
}
|
||||
return err;
|
||||
return ide_no_data_taskfile(drive, &cmd);
|
||||
}
|
||||
|
||||
ide_devset_rw(current_speed, xfer_rate);
|
||||
|
Reference in New Issue
Block a user