diff options
-rw-r--r-- | arch/x86/mm/fault.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index d973e61e450d..d7de5b8657d5 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -844,11 +844,8 @@ do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, | |||
844 | unsigned int fault) | 844 | unsigned int fault) |
845 | { | 845 | { |
846 | struct task_struct *tsk = current; | 846 | struct task_struct *tsk = current; |
847 | struct mm_struct *mm = tsk->mm; | ||
848 | int code = BUS_ADRERR; | 847 | int code = BUS_ADRERR; |
849 | 848 | ||
850 | up_read(&mm->mmap_sem); | ||
851 | |||
852 | /* Kernel mode? Handle exceptions or die: */ | 849 | /* Kernel mode? Handle exceptions or die: */ |
853 | if (!(error_code & PF_USER)) { | 850 | if (!(error_code & PF_USER)) { |
854 | no_context(regs, error_code, address, SIGBUS, BUS_ADRERR); | 851 | no_context(regs, error_code, address, SIGBUS, BUS_ADRERR); |
@@ -879,7 +876,6 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, | |||
879 | unsigned long address, unsigned int fault) | 876 | unsigned long address, unsigned int fault) |
880 | { | 877 | { |
881 | if (fatal_signal_pending(current) && !(error_code & PF_USER)) { | 878 | if (fatal_signal_pending(current) && !(error_code & PF_USER)) { |
882 | up_read(¤t->mm->mmap_sem); | ||
883 | no_context(regs, error_code, address, 0, 0); | 879 | no_context(regs, error_code, address, 0, 0); |
884 | return; | 880 | return; |
885 | } | 881 | } |
@@ -887,14 +883,11 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code, | |||
887 | if (fault & VM_FAULT_OOM) { | 883 | if (fault & VM_FAULT_OOM) { |
888 | /* Kernel mode? Handle exceptions or die: */ | 884 | /* Kernel mode? Handle exceptions or die: */ |
889 | if (!(error_code & PF_USER)) { | 885 | if (!(error_code & PF_USER)) { |
890 | up_read(¤t->mm->mmap_sem); | ||
891 | no_context(regs, error_code, address, | 886 | no_context(regs, error_code, address, |
892 | SIGSEGV, SEGV_MAPERR); | 887 | SIGSEGV, SEGV_MAPERR); |
893 | return; | 888 | return; |
894 | } | 889 | } |
895 | 890 | ||
896 | up_read(¤t->mm->mmap_sem); | ||
897 | |||
898 | /* | 891 | /* |
899 | * We ran out of memory, call the OOM killer, and return the | 892 | * We ran out of memory, call the OOM killer, and return the |
900 | * userspace (which will retry the fault, or kill us if we got | 893 | * userspace (which will retry the fault, or kill us if we got |
@@ -1247,6 +1240,7 @@ good_area: | |||
1247 | return; | 1240 | return; |
1248 | 1241 | ||
1249 | if (unlikely(fault & VM_FAULT_ERROR)) { | 1242 | if (unlikely(fault & VM_FAULT_ERROR)) { |
1243 | up_read(&mm->mmap_sem); | ||
1250 | mm_fault_error(regs, error_code, address, fault); | 1244 | mm_fault_error(regs, error_code, address, fault); |
1251 | return; | 1245 | return; |
1252 | } | 1246 | } |