[PATCH 11/15] atiixp: ->speedproc, filter out invalid modes passed from user-space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@xxxxxxxxx>
---
 drivers/ide/pci/atiixp.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Index: b/drivers/ide/pci/atiixp.c
===================================================================
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/pci/atiixp.c	Version 0.02	Jun 16 2007
+ *  linux/drivers/ide/pci/atiixp.c	Version 0.03	Jun 30 2007
  *
  *  Copyright (C) 2003 ATI Inc. <hyu@xxxxxxx>
  *  Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz
@@ -186,6 +186,17 @@ static int atiixp_speedproc(ide_drive_t 
 		return ide_config_drive_speed(drive, speed);
 	}
 
+	/*
+	 * Paranoia, filter out invalid modes passed from user-space
+	 * (UDMA > 5 modes are already dealt by ide_rate_filter() call).
+	 *
+	 * This will go away once ide_set_xfer() is fixed.
+	 */
+	if ((speed > XFER_PIO_4 && speed < XFER_SW_DMA_2) ||
+	    (speed > XFER_SW_DMA_2 && speed < XFER_MW_DMA_0) ||
+	    (speed > XFER_MW_DMA_2 && speed < XFER_UDMA_0));
+		return -1;
+
 	spin_lock_irqsave(&atiixp_lock, flags);
 
 	save_mdma_mode[drive->dn] = 0;
-
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux