]> git.hungrycats.org Git - linux/commitdiff
MIPS: ptrace: Avoid smp_processor_id() when retrieving FPU IR
authorAlex Smith <alex@alex-smith.me.uk>
Wed, 23 Jul 2014 13:40:06 +0000 (14:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Sep 2014 16:22:02 +0000 (09:22 -0700)
commit 656ff9bef08c19a6471b49528dacb4cbbeb1e537 upstream.

Whenever ptrace attempts to retrieve the FPU implementation register it
accesses it through current_cpu_data, which calls smp_processor_id().
Since the code may execute with preemption enabled, this can trigger
a warning. Fix this by using boot_cpu_data to get the IR instead.

Signed-off-by: Alex Smith <alex@alex-smith.me.uk>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7449/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/mips/kernel/ptrace.c
arch/mips/kernel/ptrace32.c

index 3d0879a32736078e7464d662e2c14dfa7e0979f8..8bd13ed084d249a530b28702b093c721680978a9 100644 (file)
@@ -129,7 +129,7 @@ int ptrace_getfpregs(struct task_struct *child, __u32 __user *data)
        }
 
        __put_user(child->thread.fpu.fcr31, data + 64);
-       __put_user(current_cpu_data.fpu_id, data + 65);
+       __put_user(boot_cpu_data.fpu_id, data + 65);
 
        return 0;
 }
@@ -611,7 +611,7 @@ long arch_ptrace(struct task_struct *child, long request,
                        break;
                case FPC_EIR:
                        /* implementation / version register */
-                       tmp = current_cpu_data.fpu_id;
+                       tmp = boot_cpu_data.fpu_id;
                        break;
                case DSP_BASE ... DSP_BASE + 5: {
                        dspreg_t *dregs;
index b40c3ca60ee55161c6641d6b650829f07259004b..a83fb730b387a6174d4f46173fc4f2252cc79c02 100644 (file)
@@ -129,7 +129,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
                        break;
                case FPC_EIR:
                        /* implementation / version register */
-                       tmp = current_cpu_data.fpu_id;
+                       tmp = boot_cpu_data.fpu_id;
                        break;
                case DSP_BASE ... DSP_BASE + 5: {
                        dspreg_t *dregs;