Skip to content

Commit d6cd989

Browse files
takondraRussell King
authored andcommitted
ARM: 7939/1: traps: fix opcode endianness when read from user memory
Currently code has an inverted logic: opcode from user memory is swapped to a proper endianness only in case of read error. While normally opcode should be swapped only if it was read correctly from user memory. Reviewed-by: Victor Kamensky <victor.kamensky@linaro.org> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Taras Kondratiuk <taras.kondratiuk@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 261521f commit d6cd989

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎arch/arm/kernel/traps.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
431431
instr2 = __mem_to_opcode_thumb16(instr2);
432432
instr = __opcode_thumb32_compose(instr, instr2);
433433
}
434-
} else if (get_user(instr, (u32 __user *)pc)) {
434+
} else {
435+
if (get_user(instr, (u32 __user *)pc))
436+
goto die_sig;
435437
instr = __mem_to_opcode_arm(instr);
436-
goto die_sig;
437438
}
438439

439440
if (call_undef_hook(regs, instr) == 0)

0 commit comments

Comments
 (0)