[PATCH] ppc32: Fix address checking on lmw/stmw align exception

From: Paul Mackerras
Date: Tue Apr 26 2005 - 06:11:34 EST


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

Signed-off-by: Kumar Gala <kumar.gala@xxxxxxxxxxxxx>
Signed-off-by: Paul Mackerras <paulus@xxxxxxxxx>

---
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)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/