diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-08-20 11:48:56 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-08-20 11:48:56 +0200 |
commit | 40a2ea1bd988e3bbdb07a0708681fdb05cd7d267 (patch) | |
tree | 05806aaa27a4b0516a14a8ccf703c1501500e588 /arch/x86/kernel/cpu/perf_event.c | |
parent | a897b5f0393a8a05d230c9248dc5324fb30720a0 (diff) | |
parent | 196676497f2507966f99abef63bede6a8550f8b3 (diff) |
Merge branch 'perf/urgent' into perf/core, to pick up fixes before adding more changes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/cpu/perf_event.c')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 8bac4bbecb9b..f56cf074d01a 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -2179,21 +2179,25 @@ static unsigned long get_segment_base(unsigned int segment) int idx = segment >> 3; if ((segment & SEGMENT_TI_MASK) == SEGMENT_LDT) { + struct ldt_struct *ldt; + if (idx > LDT_ENTRIES) return 0; - if (idx > current->active_mm->context.size) + /* IRQs are off, so this synchronizes with smp_store_release */ + ldt = lockless_dereference(current->active_mm->context.ldt); + if (!ldt || idx > ldt->size) return 0; - desc = current->active_mm->context.ldt; + desc = &ldt->entries[idx]; } else { if (idx > GDT_ENTRIES) return 0; - desc = raw_cpu_ptr(gdt_page.gdt); + desc = raw_cpu_ptr(gdt_page.gdt) + idx; } - return get_desc_base(desc + idx); + return get_desc_base(desc); } #ifdef CONFIG_COMPAT |