Commit 61cfce3e9a5de651613a0d01aecf2d08133f4bdd
Committed by
Greg Kroah-Hartman
1 parent
299f45902a
x86: mm: move mmap_sem unlock from mm_fault_error() to caller
commit 7fb08eca45270d0ae86e1ad9d39c40b7a55d0190 upstream. This replaces four copies in various stages of mm_fault_error() handling with just a single one. It will also allow for more natural placement of the unlocking after some further cleanup. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 1 additions and 7 deletions Side-by-side Diff
arch/x86/mm/fault.c
... | ... | @@ -844,11 +844,8 @@ |
844 | 844 | unsigned int fault) |
845 | 845 | { |
846 | 846 | struct task_struct *tsk = current; |
847 | - struct mm_struct *mm = tsk->mm; | |
848 | 847 | int code = BUS_ADRERR; |
849 | 848 | |
850 | - up_read(&mm->mmap_sem); | |
851 | - | |
852 | 849 | /* Kernel mode? Handle exceptions or die: */ |
853 | 850 | if (!(error_code & PF_USER)) { |
854 | 851 | no_context(regs, error_code, address, SIGBUS, BUS_ADRERR); |
... | ... | @@ -879,7 +876,6 @@ |
879 | 876 | unsigned long address, unsigned int fault) |
880 | 877 | { |
881 | 878 | if (fatal_signal_pending(current) && !(error_code & PF_USER)) { |
882 | - up_read(¤t->mm->mmap_sem); | |
883 | 879 | no_context(regs, error_code, address, 0, 0); |
884 | 880 | return; |
885 | 881 | } |
886 | 882 | |
... | ... | @@ -887,14 +883,11 @@ |
887 | 883 | if (fault & VM_FAULT_OOM) { |
888 | 884 | /* Kernel mode? Handle exceptions or die: */ |
889 | 885 | if (!(error_code & PF_USER)) { |
890 | - up_read(¤t->mm->mmap_sem); | |
891 | 886 | no_context(regs, error_code, address, |
892 | 887 | SIGSEGV, SEGV_MAPERR); |
893 | 888 | return; |
894 | 889 | } |
895 | 890 | |
896 | - up_read(¤t->mm->mmap_sem); | |
897 | - | |
898 | 891 | /* |
899 | 892 | * We ran out of memory, call the OOM killer, and return the |
900 | 893 | * userspace (which will retry the fault, or kill us if we got |
... | ... | @@ -1249,6 +1242,7 @@ |
1249 | 1242 | return; |
1250 | 1243 | |
1251 | 1244 | if (unlikely(fault & VM_FAULT_ERROR)) { |
1245 | + up_read(&mm->mmap_sem); | |
1252 | 1246 | mm_fault_error(regs, error_code, address, fault); |
1253 | 1247 | return; |
1254 | 1248 | } |