sparc/ptrace: Preserve previous registers for short regset write
authorDave Martin <Dave.Martin@arm.com>
Mon, 27 Mar 2017 14:10:59 +0000 (15:10 +0100)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 29 Mar 2017 15:54:17 +0000 (08:54 -0700)
Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/sparc/kernel/ptrace_64.c

index 901063c1cf7eedcfed5a19d0f2135afd9e6d7958..341129a40e944aa7fa17dde980b74ca756f4d656 100644 (file)
@@ -350,7 +350,7 @@ static int genregs64_set(struct task_struct *target,
        }
 
        if (!ret) {
-               unsigned long y;
+               unsigned long y = regs->y;
 
                ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
                                         &y,