]> rtime.felk.cvut.cz Git - linux-imx.git/blobdiff - arch/xtensa/kernel/ptrace.c
xtensa: prevent arbitrary read in ptrace
[linux-imx.git] / arch / xtensa / kernel / ptrace.c
index c72c9473ef9913f9666ff54f869fe35fdfd27509..a0d042aa296755e441fe4266a7103b315a581a34 100644 (file)
@@ -147,6 +147,9 @@ int ptrace_setxregs(struct task_struct *child, void __user *uregs)
        elf_xtregs_t *xtregs = uregs;
        int ret = 0;
 
+       if (!access_ok(VERIFY_READ, uregs, sizeof(elf_xtregs_t)))
+               return -EFAULT;
+
 #if XTENSA_HAVE_COPROCESSORS
        /* Flush all coprocessors before we overwrite them. */
        coprocessor_flush_all(ti);