Skip to content

Commit 29ef55c

Browse files
committed
KVM: arm64: Fail the idreg iterator if idregs aren't initialized
Return an error to userspace if the VM's ID register values haven't been initialized in preparation for changing the debugfs file initialization order. Reviewed-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 99101dd commit 29ef55c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/kvm/sys_regs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3431,7 +3431,8 @@ static void *idregs_debug_start(struct seq_file *s, loff_t *pos)
34313431
mutex_lock(&kvm->arch.config_lock);
34323432

34333433
iter = &kvm->arch.idreg_debugfs_iter;
3434-
if (*iter == (u8)~0) {
3434+
if (test_bit(KVM_ARCH_FLAG_ID_REGS_INITIALIZED, &kvm->arch.flags) &&
3435+
*iter == (u8)~0) {
34353436
*iter = *pos;
34363437
if (*iter >= KVM_ARM_ID_REG_NUM)
34373438
iter = NULL;

0 commit comments

Comments
 (0)