aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorTaras Kondratiuk <taras.kondratiuk@linaro.org>2014-01-10 01:36:00 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-01-11 12:06:59 +0000
commitd6cd989477e2fee29ccda257614ef7b2621d0601 (patch)
tree7abdd9c40c80eb2b44352d6c7c200e5dad83f26b /arch
parentARM: 7937/1: perf_event: Silence sparse warning (diff)
downloadlinux-dev-d6cd989477e2fee29ccda257614ef7b2621d0601.tar.xz
linux-dev-d6cd989477e2fee29ccda257614ef7b2621d0601.zip
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/traps.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 6eda3bf85c52..4636d56af2db 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -431,9 +431,10 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
instr2 = __mem_to_opcode_thumb16(instr2);
instr = __opcode_thumb32_compose(instr, instr2);
}
- } else if (get_user(instr, (u32 __user *)pc)) {
+ } else {
+ if (get_user(instr, (u32 __user *)pc))
+ goto die_sig;
instr = __mem_to_opcode_arm(instr);
- goto die_sig;
}
if (call_undef_hook(regs, instr) == 0)