diff options
Diffstat (limited to 'arch/x86/kernel/step.c')
-rw-r--r-- | arch/x86/kernel/step.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kernel/step.c b/arch/x86/kernel/step.c index 9b4d51d0c0d0..0ccb53a9fcd9 100644 --- a/arch/x86/kernel/step.c +++ b/arch/x86/kernel/step.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/mm.h> | 5 | #include <linux/mm.h> |
6 | #include <linux/ptrace.h> | 6 | #include <linux/ptrace.h> |
7 | #include <asm/desc.h> | 7 | #include <asm/desc.h> |
8 | #include <asm/mmu_context.h> | ||
8 | 9 | ||
9 | unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs) | 10 | unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *regs) |
10 | { | 11 | { |
@@ -27,13 +28,14 @@ unsigned long convert_ip_to_linear(struct task_struct *child, struct pt_regs *re | |||
27 | struct desc_struct *desc; | 28 | struct desc_struct *desc; |
28 | unsigned long base; | 29 | unsigned long base; |
29 | 30 | ||
30 | seg &= ~7UL; | 31 | seg >>= 3; |
31 | 32 | ||
32 | mutex_lock(&child->mm->context.lock); | 33 | mutex_lock(&child->mm->context.lock); |
33 | if (unlikely((seg >> 3) >= child->mm->context.size)) | 34 | if (unlikely(!child->mm->context.ldt || |
35 | seg >= child->mm->context.ldt->size)) | ||
34 | addr = -1L; /* bogus selector, access would fault */ | 36 | addr = -1L; /* bogus selector, access would fault */ |
35 | else { | 37 | else { |
36 | desc = child->mm->context.ldt + seg; | 38 | desc = &child->mm->context.ldt->entries[seg]; |
37 | base = get_desc_base(desc); | 39 | base = get_desc_base(desc); |
38 | 40 | ||
39 | /* 16-bit code segment? */ | 41 | /* 16-bit code segment? */ |