[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20100806175611.072806588@clark.site>
Date: Fri, 06 Aug 2010 10:54:37 -0700
From: Greg KH <gregkh@...e.de>
To: linux-kernel@...r.kernel.org, stable@...nel.org
Cc: stable-review@...nel.org, torvalds@...ux-foundation.org,
akpm@...ux-foundation.org, alan@...rguk.ukuu.org.uk,
Helge Deller <deller@....de>, Kyle McMartin <kyle@...artin.ca>,
"James E.J. Bottomley" <jejb@...isc-linux.org>
Subject: [1/4] PARISC: led.c - fix potential stack overflow in led_proc_write()
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Helge Deller <deller@....de>
commit 4b4fd27c0b5ec638a1f06ced9226fd95229dbbf0 upstream.
avoid potential stack overflow by correctly checking count parameter
Reported-by: Ilja <ilja@...ric.org>
Signed-off-by: Helge Deller <deller@....de>
Acked-by: Kyle McMartin <kyle@...artin.ca>
Cc: James E.J. Bottomley <jejb@...isc-linux.org>
Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
---
drivers/parisc/led.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -182,16 +182,18 @@ static int led_proc_read(char *page, cha
static int led_proc_write(struct file *file, const char *buf,
unsigned long count, void *data)
{
- char *cur, lbuf[count + 1];
+ char *cur, lbuf[32];
int d;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
- memset(lbuf, 0, count + 1);
+ if (count >= sizeof(lbuf))
+ count = sizeof(lbuf)-1;
if (copy_from_user(lbuf, buf, count))
return -EFAULT;
+ lbuf[count] = 0;
cur = lbuf;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists