Browse Source

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

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@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Paul Mackerras 20 years ago
parent
commit
d5812a77e5
1 changed files with 4 additions and 0 deletions
  1. 4 0
      arch/ppc/kernel/align.c

+ 4 - 0
arch/ppc/kernel/align.c

@@ -290,6 +290,10 @@ fix_alignment(struct pt_regs *regs)
 			/* lwm, stmw */
 			/* lwm, stmw */
 			nb = (32 - reg) * 4;
 			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];
 		rptr = (unsigned char *) &regs->gpr[reg];
 		if (flags & LD) {
 		if (flags & LD) {
 			for (i = 0; i < nb; ++i)
 			for (i = 0; i < nb; ++i)