Skip to content

Commit 64ea33f

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/mm,fault: call do_fault_error() only from do_exception()
Remove duplicated fault error handling and handle it only once within do_exception(). Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 5db0656 commit 64ea33f

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

arch/s390/mm/fault.c

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static void do_fault_error(struct pt_regs *regs, vm_fault_t fault)
321321
* 11 Page translation -> Not present (nullification)
322322
* 3b Region third trans. -> Not present (nullification)
323323
*/
324-
static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
324+
static void do_exception(struct pt_regs *regs, int access)
325325
{
326326
struct vm_area_struct *vma;
327327
struct task_struct *tsk;
@@ -340,7 +340,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
340340
*/
341341
clear_thread_flag(TIF_PER_TRAP);
342342
if (kprobe_page_fault(regs, 14))
343-
return 0;
343+
return;
344344
mm = tsk->mm;
345345
address = get_fault_address(regs);
346346
is_write = fault_is_write(regs);
@@ -468,14 +468,13 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
468468
out_up:
469469
mmap_read_unlock(mm);
470470
out:
471-
return fault;
471+
if (unlikely(fault))
472+
do_fault_error(regs, fault);
472473
}
473474

474475
void do_protection_exception(struct pt_regs *regs)
475476
{
476477
union teid teid = { .val = regs->int_parm_long };
477-
vm_fault_t fault;
478-
int access;
479478

480479
/*
481480
* Protection exceptions are suppressing, decrement psw address.
@@ -502,26 +501,16 @@ void do_protection_exception(struct pt_regs *regs)
502501
}
503502
if (unlikely(MACHINE_HAS_NX && teid.b56)) {
504503
regs->int_parm_long = (teid.addr * PAGE_SIZE) | (regs->psw.addr & PAGE_MASK);
505-
access = VM_EXEC;
506-
fault = VM_FAULT_BADACCESS;
507-
} else {
508-
access = VM_WRITE;
509-
fault = do_exception(regs, access);
504+
do_fault_error(regs, VM_FAULT_BADACCESS);
505+
return;
510506
}
511-
if (unlikely(fault))
512-
do_fault_error(regs, fault);
507+
do_exception(regs, VM_WRITE);
513508
}
514509
NOKPROBE_SYMBOL(do_protection_exception);
515510

516511
void do_dat_exception(struct pt_regs *regs)
517512
{
518-
vm_fault_t fault;
519-
int access;
520-
521-
access = VM_ACCESS_FLAGS;
522-
fault = do_exception(regs, access);
523-
if (unlikely(fault))
524-
do_fault_error(regs, fault);
513+
do_exception(regs, VM_ACCESS_FLAGS);
525514
}
526515
NOKPROBE_SYMBOL(do_dat_exception);
527516

0 commit comments

Comments
 (0)