powerpc/mm: Move mmap_sem unlock up from do_sigbus
authorLaurent Dufour <ldufour@linux.vnet.ibm.com>
Tue, 14 Feb 2017 16:45:10 +0000 (17:45 +0100)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 21 Mar 2017 11:08:53 +0000 (22:08 +1100)
Move mmap_sem releasing in the do_sigbus()'s unique caller : mm_fault_error()

No functional changes.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/fault.c

index 51def8a515be81438bc28dea1e076cbcbd838487..2d77c1c8014aaa21cceda29cbd62876d5f92bcc1 100644 (file)
@@ -120,8 +120,6 @@ static int do_sigbus(struct pt_regs *regs, unsigned long address,
        siginfo_t info;
        unsigned int lsb = 0;
 
-       up_read(&current->mm->mmap_sem);
-
        if (!user_mode(regs))
                return MM_FAULT_ERR(SIGBUS);
 
@@ -185,8 +183,10 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
                return MM_FAULT_RETURN;
        }
 
-       if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE))
+       if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
+               up_read(&current->mm->mmap_sem);
                return do_sigbus(regs, addr, fault);
+       }
 
        /* We don't understand the fault code, this is fatal */
        BUG();