ide: filter out invalid DMA xfer mode changes in HDIO_DRIVE_CMD ioctl handler

Signed-off-by: NBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
上级 5bfb151f
...@@ -118,7 +118,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -118,7 +118,6 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
u8 args[4], xfer_rate = 0; u8 args[4], xfer_rate = 0;
struct ide_cmd cmd; struct ide_cmd cmd;
struct ide_taskfile *tf = &cmd.tf; struct ide_taskfile *tf = &cmd.tf;
u16 *id = drive->id;
if (NULL == (void *) arg) { if (NULL == (void *) arg) {
struct request *rq; struct request *rq;
...@@ -161,14 +160,10 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg) ...@@ -161,14 +160,10 @@ static int ide_cmd_ioctl(ide_drive_t *drive, unsigned long arg)
if (tf->command == ATA_CMD_SET_FEATURES && if (tf->command == ATA_CMD_SET_FEATURES &&
tf->feature == SETFEATURES_XFER && tf->feature == SETFEATURES_XFER &&
tf->nsect >= XFER_SW_DMA_0 && tf->nsect >= XFER_SW_DMA_0) {
(id[ATA_ID_UDMA_MODES] || xfer_rate = ide_find_dma_mode(drive, XFER_UDMA_6);
id[ATA_ID_MWDMA_MODES] || if (xfer_rate != tf->nsect) {
id[ATA_ID_SWDMA_MODES])) { err = -EINVAL;
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);
goto abort; goto abort;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册