[PATCH] Memset the kernel copy of rtas args before using

Nathan Fontenot nfont at austin.ibm.com
Sat Jul 26 07:25:47 EST 2008


The kernel copy of the rtas args struct that is read in from
user space is a stack variable.  This structure should be
zero'ed out before we do any reads/writes to/from the user
when handling a rtas call request.  This patch adds a memset
to do this.

I am seeing an issue in testing partition mobility, where the
parts of the rtas args struct that return status top the user
contain stale data.

Signed-off-by: Nathan Fontenot <nfont at ausitn,ibm.com>
---

Index: linux-2.6.git/arch/powerpc/kernel/rtas.c
===================================================================
--- linux-2.6.git.orig/arch/powerpc/kernel/rtas.c	2008-07-22 09:34:03.000000000 -0500
+++ linux-2.6.git/arch/powerpc/kernel/rtas.c	2008-07-25 16:06:00.000000000 -0500
@@ -775,6 +775,8 @@
 	if (!capable(CAP_SYS_ADMIN))
 		return -EPERM;
 
+	memset(&args, 0, sizeof(args));
+
 	if (copy_from_user(&args, uargs, 3 * sizeof(u32)) != 0)
 		return -EFAULT;
 



More information about the Linuxppc-dev mailing list