Return-Path: Received: from mailapp01.imgtec.com ([195.59.15.196]:61309 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752428AbcKGPJA (ORCPT ); Mon, 7 Nov 2016 10:09:00 -0500 From: Paul Burton To: CC: Ralf Baechle , Paul Burton , Leonid Yegoshin , "# v3 . 10+" Subject: [PATCH 4/6] MIPS: Fix is_jump_ins() handling of 16b microMIPS instructions Date: Mon, 7 Nov 2016 15:07:05 +0000 Message-ID: <20161107150707.5079-5-paul.burton@imgtec.com> In-Reply-To: <20161107150707.5079-1-paul.burton@imgtec.com> References: <20161107150707.5079-1-paul.burton@imgtec.com> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org List-ID: 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 Fixes: 34c2f668d0f6 ("MIPS: microMIPS: Add unaligned access support.") Cc: linux-mips@linux-mips.org Cc: Ralf Baechle Cc: Leonid Yegoshin Cc: # v3.10+ --- arch/mips/kernel/process.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index d56ef4b..298dc33 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) * * microMIPS is kind of more fun... */ - if ((ip->mm16_r5_format.opcode == mm_pool16c_op && - (ip->mm16_r5_format.rt & mm_jr16_op) == mm_jr16_op) || - ip->j_format.opcode == mm_jal32_op) + if (mm_insn_16bit(ip->halfword[1])) { + if ((ip->mm16_r5_format.opcode == mm_pool16c_op && + (ip->mm16_r5_format.rt & mm_jr16_op) == mm_jr16_op)) + return 1; + return 0; + } + + if (ip->j_format.opcode == mm_jal32_op) return 1; if (ip->r_format.opcode != mm_pool32a_op || ip->r_format.func != mm_pool32axf_op) -- 2.10.2