[PATCH] ppc32: Fix alignment exception checking on load/store multiple instructions

Kumar Gala galak at freescale.com
Tue Apr 12 16:03:44 EST 2005


Paulus,

Can you take a look and ack this patch before I send to akpm.

The handling of misaligned load/store multiplies did not check to see if 
the address were ok to access before __{get,put}_user().


Signed-off-by: Kumar Gala <kumar.gala at freescale.com>

---
diff -Nru a/arch/ppc/kernel/align.c b/arch/ppc/kernel/align.c
--- a/arch/ppc/kernel/align.c	2005-04-12 01:00:10 -05:00
+++ b/arch/ppc/kernel/align.c	2005-04-12 01:00:10 -05:00
@@ -290,6 +290,10 @@
 			/* lwm, stmw */
 			nb = (32 - reg) * 4;
 		}
+
+		if (!access_ok((flags & ST? VERIFY_WRITE: VERIFY_READ), addr, nb+nb0))
+			return -EFAULT;	/* bad address */
+
 		rptr = (unsigned char *) &regs->gpr[reg];
 		if (flags & LD) {
 			for (i = 0; i < nb; ++i)



More information about the Linuxppc-dev mailing list