Skip to content

Commit

Permalink
MIPS: ptrace: Avoid smp_processor_id() when retrieving FPU IR
Browse files Browse the repository at this point in the history
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: <stable@vger.kernel.org> # v3.15+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/7449/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Alex Smith authored and Ralf Baechle committed Jul 30, 2014
1 parent 6ee1d93 commit 656ff9b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions arch/mips/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -480,7 +480,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;
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/ptrace32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 656ff9b

Please sign in to comment.