From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Subject: [PATCH 11/15] atiixp: ->speedproc, filter out invalid modes passed from user-space
Date: Sat, 30 Jun 2007 21:09:46 +0200 [thread overview]
Message-ID: <200706302109.46258.bzolnier@gmail.com> (raw)
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
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@ati.com>
* 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;
reply other threads:[~2007-06-30 19:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200706302109.46258.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).