s390/mm,fault: call do_fault_error() only from do_exception()
authorHeiko Carstens <hca@linux.ibm.com>
Thu, 12 Oct 2023 07:40:47 +0000 (09:40 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 23 Oct 2023 16:21:22 +0000 (18:21 +0200)
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>
arch/s390/mm/fault.c

index 87bfcf4d30827142324198cf21a91ad525d35e0c..9ed9796906654f93a67528648e06e7126bda26bd 100644 (file)
@@ -321,7 +321,7 @@ static void do_fault_error(struct pt_regs *regs, vm_fault_t fault)
  *   11       Page translation    ->  Not present       (nullification)
  *   3b       Region third trans.  ->  Not present      (nullification)
  */
-static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
+static void do_exception(struct pt_regs *regs, int access)
 {
        struct vm_area_struct *vma;
        struct task_struct *tsk;
@@ -340,7 +340,7 @@ static inline vm_fault_t do_exception(struct pt_regs *regs, int access)
         */
        clear_thread_flag(TIF_PER_TRAP);
        if (kprobe_page_fault(regs, 14))
-               return 0;
+               return;
        mm = tsk->mm;
        address = get_fault_address(regs);
        is_write = fault_is_write(regs);
@@ -468,14 +468,13 @@ out_gmap:
 out_up:
        mmap_read_unlock(mm);
 out:
-       return fault;
+       if (unlikely(fault))
+               do_fault_error(regs, fault);
 }
 
 void do_protection_exception(struct pt_regs *regs)
 {
        union teid teid = { .val = regs->int_parm_long };
-       vm_fault_t fault;
-       int access;
 
        /*
         * Protection exceptions are suppressing, decrement psw address.
@@ -502,26 +501,16 @@ void do_protection_exception(struct pt_regs *regs)
        }
        if (unlikely(MACHINE_HAS_NX && teid.b56)) {
                regs->int_parm_long = (teid.addr * PAGE_SIZE) | (regs->psw.addr & PAGE_MASK);
-               access = VM_EXEC;
-               fault = VM_FAULT_BADACCESS;
-       } else {
-               access = VM_WRITE;
-               fault = do_exception(regs, access);
+               do_fault_error(regs, VM_FAULT_BADACCESS);
+               return;
        }
-       if (unlikely(fault))
-               do_fault_error(regs, fault);
+       do_exception(regs, VM_WRITE);
 }
 NOKPROBE_SYMBOL(do_protection_exception);
 
 void do_dat_exception(struct pt_regs *regs)
 {
-       vm_fault_t fault;
-       int access;
-
-       access = VM_ACCESS_FLAGS;
-       fault = do_exception(regs, access);
-       if (unlikely(fault))
-               do_fault_error(regs, fault);
+       do_exception(regs, VM_ACCESS_FLAGS);
 }
 NOKPROBE_SYMBOL(do_dat_exception);