[parisc-linux-cvs] Audit copy_from_user in led_proc_write."-patch by Daniele Bellucci

Helge Deller deller@gmx.de
Sat, 19 Jul 2003 09:35:34 +0200


--Boundary-00=_GTPG/SjpA/AI4IF
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

applied the "Audit copy_from_user in led_proc_write."-patch by Daniele Bellucci
to parisc-linux kernel CVS trees for kernel 2.4 and kernel 2.6-test*

On Saturday 19 July 2003 09:24, Helge Deller wrote:
> CVSROOT:	/var/cvs
> Module name:	linux-2.5
> Changes by:	deller	03/07/19 01:24:06
>
> Modified files:
> 	drivers/parisc : led.c
>
> Log message:
> apply "Audit copy_from_user in led_proc_write."-patch by Daniele Bellucci
> <bellucda@tiscali.it>



--Boundary-00=_GTPG/SjpA/AI4IF
Content-Type: text/plain;
  charset="iso-8859-1";
  name="patch2"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="patch2"

Index: led.c
===================================================================
RCS file: /var/cvs/linux-2.5/drivers/parisc/led.c,v
retrieving revision 1.10
diff -u -p -r1.10 led.c
--- led.c	4 Jun 2003 00:45:51 -0000	1.10
+++ led.c	19 Jul 2003 07:23:13 -0000
@@ -14,6 +14,10 @@
  * TODO:
  *	- speed-up calculations with inlined assembler
  *	- interface to write to second row of LCD from /proc (if technically possible)
+ *
+ * Changes:
+ *      - Audit copy_from_user in led_proc_write.
+ *                                Daniele Bellucci <bellucda@tiscali.it>
  */
 
 #include <linux/config.h>
@@ -160,7 +164,9 @@ static int led_proc_write(struct file *f
 
 	memset(lbuf, 0, count);
 
-	copy_from_user(lbuf, buf, count);
+	if (copy_from_user(lbuf, buf, count))
+		return -EFAULT;
+
 	cur = lbuf;
 
 	/* skip initial spaces */

--Boundary-00=_GTPG/SjpA/AI4IF--