diff options
author | Paul Burton <paul.burton@imgtec.com> | 2016-11-07 10:07:05 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-12 00:41:40 -0500 |
commit | b14e085086245a829a87f6cc44c996333c641390 (patch) | |
tree | 9118063dd96cc89ff33ea06777e5b20105a1175c /arch/mips/kernel | |
parent | b0b4eb58c5efe31c5dbd8fc771b43bb13bf84430 (diff) |
MIPS: Fix is_jump_ins() handling of 16b microMIPS instructions
commit 67c75057709a6d85c681c78b9b2f9b71191f01a2 upstream.
is_jump_ins() checks 16b instruction fields without verifying that the
instruction is indeed 16b, as is done by is_ra_save_ins() &
is_sp_move_ins(). Add the appropriate check.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: 34c2f668d0f6 ("MIPS: microMIPS: Add unaligned access support.")
Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14531/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r-- | arch/mips/kernel/process.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index d56ef4ba0a84..298dc33737b0 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -241,9 +241,14 @@ static inline int is_jump_ins(union mips_instruction *ip) | |||
241 | * | 241 | * |
242 | * microMIPS is kind of more fun... | 242 | * microMIPS is kind of more fun... |
243 | */ | 243 | */ |
244 | if ((ip->mm16_r5_format.opcode == mm_pool16c_op && | 244 | if (mm_insn_16bit(ip->halfword[1])) { |
245 | (ip->mm16_r5_format.rt & mm_jr16_op) == mm_jr16_op) || | 245 | if ((ip->mm16_r5_format.opcode == mm_pool16c_op && |
246 | ip->j_format.opcode == mm_jal32_op) | 246 | (ip->mm16_r5_format.rt & mm_jr16_op) == mm_jr16_op)) |
247 | return 1; | ||
248 | return 0; | ||
249 | } | ||
250 | |||
251 | if (ip->j_format.opcode == mm_jal32_op) | ||
247 | return 1; | 252 | return 1; |
248 | if (ip->r_format.opcode != mm_pool32a_op || | 253 | if (ip->r_format.opcode != mm_pool32a_op || |
249 | ip->r_format.func != mm_pool32axf_op) | 254 | ip->r_format.func != mm_pool32axf_op) |