Skip to content

Commit af7630c

Browse files
Tao Cuigregkh
authored andcommitted
LoongArch: KVM: Fix missing EMULATE_FAIL in kvm_emu_mmio_read()
commit f26faae upstream. In the ldptr (0x24...0x27) opcode decoding path, the default case only breaks out but without setting "ret" value to EMULATE_FAIL. This leaves run->mmio.len uninitialized (stale from a previous MMIO operation) while "ret" value remains EMULATE_DO_MMIO, causing the code to proceed with an incorrect MMIO length. Add "ret = EMULATE_FAIL" to match the other default branches in the same function (e.g. the 0x28...0x2e and 0x38 cases). Cc: stable@vger.kernel.org Reviewed-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Tao Cui <cuitao@kylinos.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d96c449 commit af7630c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/loongarch/kvm/exit.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ int kvm_emu_mmio_read(struct kvm_vcpu *vcpu, larch_inst inst)
390390
run->mmio.len = 8;
391391
break;
392392
default:
393+
ret = EMULATE_FAIL;
393394
break;
394395
}
395396
break;

0 commit comments

Comments
 (0)