]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - arch/powerpc/mm/fault.c
arch: mm: pass userspace fault flag to generic fault handler
[karo-tx-linux.git] / arch / powerpc / mm / fault.c
index 2dd69bf4af46f2c7eee675f9ed1b05ec98eb5aa6..51ab9e7e6c391b9497a08730a7b5e4c625c96304 100644 (file)
@@ -223,9 +223,6 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
        is_write = error_code & ESR_DST;
 #endif /* CONFIG_4xx || CONFIG_BOOKE */
 
-       if (is_write)
-               flags |= FAULT_FLAG_WRITE;
-
 #ifdef CONFIG_PPC_ICSWX
        /*
         * we need to do this early because this "data storage
@@ -288,6 +285,9 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
        if (user_mode(regs))
                store_update_sp = store_updates_sp(regs);
 
+       if (user_mode(regs))
+               flags |= FAULT_FLAG_USER;
+
        /* When running in the kernel we expect faults to occur only to
         * addresses in user space.  All other faults represent errors in the
         * kernel and should generate an OOPS.  Unfortunately, in the case of an
@@ -415,6 +415,7 @@ good_area:
        } else if (is_write) {
                if (!(vma->vm_flags & VM_WRITE))
                        goto bad_area;
+               flags |= FAULT_FLAG_WRITE;
        /* a read */
        } else {
                /* protection fault */