Commit 88870813 authored by Archer Yan's avatar Archer Yan Committed by Greg Kroah-Hartman

MIPS: Fix kernel crash for R6 in jump label branch function

commit 47c25036b60f27b86ab44b66a8861bcf81cde39b upstream.

Insert Branch instruction instead of NOP to make sure assembler don't
patch code in forbidden slot. In jump label function, it might
be possible to patch Control Transfer Instructions(CTIs) into
forbidden slot, which will generate Reserved Instruction exception
in MIPS release 6.
Signed-off-by: default avatarArcher Yan <>
Reviewed-by: default avatarPaul Burton <>
  - Add MIPS prefix to subject.
  - Mark for stable from v4.0, which introduced r6 support, onwards.]
Signed-off-by: default avatarPaul Burton <>
Cc: # v4.0+
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 005b0a33
......@@ -21,15 +21,15 @@
#define NOP_INSN "nop32"
#define B_INSN "b32"
#define NOP_INSN "nop"
#define B_INSN "b"
static __always_inline bool arch_static_branch(struct static_key *key, bool branch)
asm_volatile_goto("1:\t" NOP_INSN "\n\t"
asm_volatile_goto("1:\t" B_INSN " 2f\n\t"
".pushsection __jump_table, \"aw\"\n\t"
WORD_INSN " 1b, %l[l_yes], %0\n\t"
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment