summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2017-07-19 14:49:33 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2017-08-03 16:06:46 +1000
commit65d47fd4a37cbd60d0737cdae09edf1d208364d7 (patch)
tree7f3823cfd8f67b83727d783480bbe878007decb3 /arch/powerpc
parentbb4be50e619b86eea31a28b09bf9fa3fcc5f4976 (diff)
powerpc/mm: Simplify returns from __do_page_fault
Now that we moved the exception state handling to a wrapper, we can just directly return rather than "goto bail" Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/mm/fault.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 2f825ae68f20..e8d6acc888c5 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -233,39 +233,36 @@ static int __do_page_fault(struct pt_regs *regs, unsigned long address,
if (error_code & ICSWX_DSI_UCT) {
rc = acop_handle_fault(regs, address, error_code);
if (rc)
- goto bail;
+ return rc;
}
#endif /* CONFIG_PPC_ICSWX */
if (notify_page_fault(regs))
- goto bail;
+ return 0;
if (unlikely(page_fault_is_bad(error_code))) {
- if (is_user)
+ if (is_user) {
_exception(SIGBUS, regs, BUS_OBJERR, address);
- else
- rc = SIGBUS;
- goto bail;
+ return 0;
+ }
+ return SIGBUS;
}
/*
* The kernel should never take an execute fault nor should it
* take a page fault to a kernel address.
*/
- if (!is_user && (is_exec || (address >= TASK_SIZE))) {
- rc = SIGSEGV;
- goto bail;
- }
+ if (!is_user && (is_exec || (address >= TASK_SIZE)))
+ return SIGSEGV;
/* We restore the interrupt state now */
if (!arch_irq_disabled_regs(regs))
local_irq_enable();
if (faulthandler_disabled() || mm == NULL) {
- if (!is_user) {
- rc = SIGSEGV;
- goto bail;
- }
+ if (!is_user)
+ return SIGSEGV;
+
/* faulthandler_disabled() in user mode is really bad,
as is current->mm == NULL. */
printk(KERN_EMERG "Page fault in user mode with "
@@ -454,9 +451,8 @@ good_area:
goto bad_area_nosemaphore;
rc = mm_fault_error(regs, address, fault);
if (rc >= MM_FAULT_RETURN)
- goto bail;
- else
- rc = 0;
+ return rc;
+ rc = 0;
}
/*
@@ -483,7 +479,7 @@ good_area:
regs, address);
}
- goto bail;
+ return rc;
bad_area:
up_read(&mm->mmap_sem);
@@ -492,7 +488,7 @@ bad_area_nosemaphore:
/* User mode accesses cause a SIGSEGV */
if (is_user) {
_exception(SIGSEGV, regs, code, address);
- goto bail;
+ return 0;
}
if (is_exec && (error_code & DSISR_PROTFAULT))
@@ -500,10 +496,7 @@ bad_area_nosemaphore:
" page (%lx) - exploit attempt? (uid: %d)\n",
address, from_kuid(&init_user_ns, current_uid()));
- rc = SIGSEGV;
-
-bail:
- return rc;
+ return SIGSEGV;
}
NOKPROBE_SYMBOL(__do_page_fault);