]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerJiri Slaby <jslaby@suse.cz>
Fri, 7 Apr 2017 08:59:34 +0000 (10:59 +0200)
commit d3805c546b275c8cc7d40f759d029ae92c7175f2 upstream.

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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/sparc/kernel/ptrace_64.c

index 773c1f2983ce3282c59a8f93efd62663218e741f..89297b7c626111907edd61e96487663fe3041a91 100644 (file)
@@ -310,7 +310,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,