]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] x86-64: Check return value of putreg in PTRACE_SETREGS
authorAndi Kleen <ak@suse.de>
Tue, 13 Feb 2007 12:26:24 +0000 (13:26 +0100)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 13 Feb 2007 12:26:24 +0000 (13:26 +0100)
This means if an illegal value is set for the segment registers there
ptrace will error out now with an errno instead of silently ignoring
it.

Signed-off-by: Andi Kleen <ak@suse.de>
arch/x86_64/kernel/ptrace.c

index addc14af0c562a7ec485c89fc6c69d71bb3ed1ca..4326a690a509a14ae2c5c4d2980233a82864eebc 100644 (file)
@@ -536,8 +536,12 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
                }
                ret = 0;
                for (ui = 0; ui < sizeof(struct user_regs_struct); ui += sizeof(long)) {
-                       ret |= __get_user(tmp, (unsigned long __user *) data);
-                       putreg(child, ui, tmp);
+                       ret = __get_user(tmp, (unsigned long __user *) data);
+                       if (ret)
+                               break;
+                       ret = putreg(child, ui, tmp);
+                       if (ret)
+                               break;
                        data += sizeof(long);
                }
                break;