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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Paul Mackerras
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 <[hidden email]>
Signed-off-by: Paul Mackerras <[hidden email]>

---
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 [hidden email]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/