powerpc: Fix check for copy/paste instructions in alignment handler
authorPaul Mackerras <paulus@ozlabs.org>
Wed, 25 Oct 2017 07:16:53 +0000 (18:16 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Oct 2017 10:42:35 +0000 (12:42 +0200)
Commit 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch
when possible", 2017-06-09) changed the definition of PPC_INST_COPY
and in so doing inadvertently broke the check for copy/paste
instructions in the alignment fault handler. The check currently
matches no instructions.

This fixes it by ANDing both sides of the comparison with the mask.

Fixes: 07d2a628bc00 ("powerpc/64s: Avoid cpabort in context switch when possible")
Cc: stable@vger.kernel.org # v4.13+
Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/align.c

index 43ef2515648098f985ff5f7d10a66b2f6d724391..3e6c0744c174a0dc7479219b07c3b4cc26cdd68d 100644 (file)
@@ -332,7 +332,7 @@ int fix_alignment(struct pt_regs *regs)
         * when pasting to a co-processor. Furthermore, paste_last is the
         * synchronisation point for preceding copy/paste sequences.
         */
-       if ((instr & 0xfc0006fe) == PPC_INST_COPY)
+       if ((instr & 0xfc0006fe) == (PPC_INST_COPY & 0xfc0006fe))
                return -EIO;
 
        r = analyse_instr(&op, regs, instr);