aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/cpu/perf_counter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c
index 77a59a5566a8..09d8cb69c3f3 100644
--- a/arch/x86/kernel/cpu/perf_counter.c
+++ b/arch/x86/kernel/cpu/perf_counter.c
@@ -1644,7 +1644,9 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
1644 const void __user *fp; 1644 const void __user *fp;
1645 int nr = entry->nr; 1645 int nr = entry->nr;
1646 1646
1647 regs = (struct pt_regs *)current->thread.sp0 - 1; 1647 if (!user_mode(regs))
1648 regs = task_pt_regs(current);
1649
1648 fp = (void __user *)regs->bp; 1650 fp = (void __user *)regs->bp;
1649 1651
1650 callchain_store(entry, regs->ip); 1652 callchain_store(entry, regs->ip);
@@ -1656,7 +1658,7 @@ perf_callchain_user(struct pt_regs *regs, struct perf_callchain_entry *entry)
1656 if (!copy_stack_frame(fp, &frame)) 1658 if (!copy_stack_frame(fp, &frame))
1657 break; 1659 break;
1658 1660
1659 if ((unsigned long)fp < user_stack_pointer(regs)) 1661 if ((unsigned long)fp < regs->sp)
1660 break; 1662 break;
1661 1663
1662 callchain_store(entry, frame.return_address); 1664 callchain_store(entry, frame.return_address);