diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-06-23 07:35:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-07 13:43:00 -0400 |
commit | 665d66e8fad60a5a162c4615f27f916ad1a6d567 (patch) | |
tree | 2e4f699f4fec1ca4010a39b9dd787fbd5f03b44d /drivers/ide/ide-proc.c | |
parent | fa56d4cb4022c8b313c3b99236e1b87effc3655b (diff) |
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>
Diffstat (limited to 'drivers/ide/ide-proc.c')
-rw-r--r-- | drivers/ide/ide-proc.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/ide/ide-proc.c b/drivers/ide/ide-proc.c index 3242698832a4..021de41655e6 100644 --- a/drivers/ide/ide-proc.c +++ b/drivers/ide/ide-proc.c | |||
@@ -195,7 +195,6 @@ ide_devset_get(xfer_rate, current_speed); | |||
195 | static int set_xfer_rate (ide_drive_t *drive, int arg) | 195 | static int set_xfer_rate (ide_drive_t *drive, int arg) |
196 | { | 196 | { |
197 | struct ide_cmd cmd; | 197 | struct ide_cmd cmd; |
198 | int err; | ||
199 | 198 | ||
200 | if (arg < XFER_PIO_0 || arg > XFER_UDMA_6) | 199 | if (arg < XFER_PIO_0 || arg > XFER_UDMA_6) |
201 | return -EINVAL; | 200 | return -EINVAL; |
@@ -206,14 +205,9 @@ static int set_xfer_rate (ide_drive_t *drive, int arg) | |||
206 | cmd.tf.nsect = (u8)arg; | 205 | cmd.tf.nsect = (u8)arg; |
207 | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; | 206 | cmd.valid.out.tf = IDE_VALID_FEATURE | IDE_VALID_NSECT; |
208 | cmd.valid.in.tf = IDE_VALID_NSECT; | 207 | cmd.valid.in.tf = IDE_VALID_NSECT; |
208 | cmd.tf_flags = IDE_TFLAG_SET_XFER; | ||
209 | 209 | ||
210 | err = ide_no_data_taskfile(drive, &cmd); | 210 | return ide_no_data_taskfile(drive, &cmd); |
211 | |||
212 | if (!err) { | ||
213 | ide_set_xfer_rate(drive, (u8) arg); | ||
214 | ide_driveid_update(drive); | ||
215 | } | ||
216 | return err; | ||
217 | } | 211 | } |
218 | 212 | ||
219 | ide_devset_rw(current_speed, xfer_rate); | 213 | ide_devset_rw(current_speed, xfer_rate); |