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-ioctls.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-ioctls.c')
-rw-r--r-- | drivers/ide/ide-ioctls.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index e246d3d3fbcc..d3440b5010a5 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -167,6 +167,8 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
167 | err = -EINVAL; | 167 | err = -EINVAL; |
168 | goto abort; | 168 | goto abort; |
169 | } | 169 | } |
170 | |||
171 | cmd.tf_flags |= IDE_TFLAG_SET_XFER; | ||
170 | } | 172 | } |
171 | 173 | ||
172 | err = ide_raw_taskfile(drive, &cmd, buf, args[3]); | 174 | err = ide_raw_taskfile(drive, &cmd, buf, args[3]); |
@@ -174,12 +176,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) | |||
174 | args[0] = tf->status; | 176 | args[0] = tf->status; |
175 | args[1] = tf->error; | 177 | args[1] = tf->error; |
176 | args[2] = tf->nsect; | 178 | args[2] = tf->nsect; |
177 | |||
178 | if (!err && xfer_rate) { | ||
179 | /* active-retuning-calls future */ | ||
180 | ide_set_xfer_rate(drive, xfer_rate); | ||
181 | ide_driveid_update(drive); | ||
182 | } | ||
183 | abort: | 179 | abort: |
184 | if (copy_to_user((void __user *)arg, &args, 4)) | 180 | if (copy_to_user((void __user *)arg, &args, 4)) |
185 | err = -EFAULT; | 181 | err = -EFAULT; |