Skip to content

Commit

Permalink
arm64: fix return code check when changing emulation handler
Browse files Browse the repository at this point in the history
update_insn_emulation_mode() returns 0 on success, so we should be
treating any non-zero values as failure, rather than the other way
around. Otherwise, writes to the sysctl file controlling the emulation
are ignored and immediately rolled back.

Reported-by: Gene Hackmann <[email protected]>
Signed-off-by: Will Deacon <[email protected]>
  • Loading branch information
wildea01 committed Nov 25, 2014
1 parent 7f73f7a commit 9096339
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/arm64/kernel/armv8_deprecated.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static int emulation_proc_handler(struct ctl_table *table, int write,
goto ret;

ret = update_insn_emulation_mode(insn, prev_mode);
if (!ret) {
if (ret) {
/* Mode change failed, revert to previous mode. */
insn->current_mode = prev_mode;
update_insn_emulation_mode(insn, INSN_UNDEF);
Expand Down

0 comments on commit 9096339

Please sign in to comment.