]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - arch/parisc/kernel/unaligned.c
parisc: Fix pagefault crash in unaligned __get_user() call
[karo-tx-linux.git] / arch / parisc / kernel / unaligned.c
index d7c0acb35ec248c51329a5cb4594189bd5f5040f..8d49614d600d88907b19bbbdfaefc979687cd278 100644 (file)
@@ -666,7 +666,7 @@ void handle_unaligned(struct pt_regs *regs)
                break;
        }
 
-       if (modify && R1(regs->iir))
+       if (ret == 0 && modify && R1(regs->iir))
                regs->gr[R1(regs->iir)] = newbase;
 
 
@@ -677,6 +677,14 @@ void handle_unaligned(struct pt_regs *regs)
 
        if (ret)
        {
+               /*
+                * The unaligned handler failed.
+                * If we were called by __get_user() or __put_user() jump
+                * to it's exception fixup handler instead of crashing.
+                */
+               if (!user_mode(regs) && fixup_exception(regs))
+                       return;
+
                printk(KERN_CRIT "Unaligned handler failed, ret = %d\n", ret);
                die_if_kernel("Unaligned data reference", regs, 28);