summaryrefslogtreecommitdiff
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 22:13:45 +0200
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-06-15 22:13:45 +0200
commita9c415090710a108edcd81b3392b90396f190a9a (patch)
treed8e8848f695af1f3f7620f96e93431a8a76c40f3 /drivers/ide
parent5bfb151f1f565e6082304a30e8c81dfb6ed0b0c8 (diff)
downloadlinux-3.10-a9c415090710a108edcd81b3392b90396f190a9a.tar.gz
linux-3.10-a9c415090710a108edcd81b3392b90396f190a9a.tar.bz2
linux-3.10-a9c415090710a108edcd81b3392b90396f190a9a.zip
ide: filter out invalid DMA xfer mode changes in HDIO_DRIVE_CMD ioctl handler
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-ioctls.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index 5991b23793f..82f252c3ee6 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -118,7 +118,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
u8 args[4], xfer_rate = 0;
struct ide_cmd cmd;
struct ide_taskfile *tf = &cmd.tf;
- u16 *id = drive->id;
if (NULL == (void *) arg) {
struct request *rq;
@@ -161,14 +160,10 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
if (tf->command == ATA_CMD_SET_FEATURES &&
tf->feature == SETFEATURES_XFER &&
- tf->nsect >= XFER_SW_DMA_0 &&
- (id[ATA_ID_UDMA_MODES] ||
- id[ATA_ID_MWDMA_MODES] ||
- id[ATA_ID_SWDMA_MODES])) {
- xfer_rate = args[1];
- if (tf->nsect > XFER_UDMA_2 && !eighty_ninty_three(drive)) {
- printk(KERN_WARNING "%s: UDMA speeds >UDMA33 cannot "
- "be set\n", drive->name);
+ tf->nsect >= XFER_SW_DMA_0) {
+ xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
+ if (xfer_rate != tf->nsect) {
+ err = -EINVAL;
goto abort;
}
}