arm64: fix return code check when changing emulation handler
authorWill Deacon <will.deacon@arm.com>
Tue, 25 Nov 2014 10:05:35 +0000 (10:05 +0000)
committerWill Deacon <will.deacon@arm.com>
Tue, 25 Nov 2014 10:05:35 +0000 (10:05 +0000)
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 <ghackmann@google.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
arch/arm64/kernel/armv8_deprecated.c

index 529aad93336f727e768aa73c6ea943dcc517f7f5..c363671d750932c9203870c001c55eb2de8d3462 100644 (file)
@@ -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);