Commit cad23e72 authored by Miaohe Lin's avatar Miaohe Lin Committed by Paolo Bonzini

KVM: x86: check kvm_pit outside kvm_vm_ioctl_reinject()

check kvm_pit outside kvm_vm_ioctl_reinject() to keep codestyle consistent
with other kvm_pit func and prepare for futher cleanups.
Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent dfd146fc
...@@ -4703,9 +4703,6 @@ static int kvm_vm_ioctl_reinject(struct kvm *kvm, ...@@ -4703,9 +4703,6 @@ static int kvm_vm_ioctl_reinject(struct kvm *kvm,
{ {
struct kvm_pit *pit = kvm->arch.vpit; struct kvm_pit *pit = kvm->arch.vpit;
if (!pit)
return -ENXIO;
/* pit->pit_state.lock was overloaded to prevent userspace from getting /* pit->pit_state.lock was overloaded to prevent userspace from getting
* an inconsistent state after running multiple KVM_REINJECT_CONTROL * an inconsistent state after running multiple KVM_REINJECT_CONTROL
* ioctls in parallel. Use a separate lock if that ioctl isn't rare. * ioctls in parallel. Use a separate lock if that ioctl isn't rare.
...@@ -5072,6 +5069,9 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -5072,6 +5069,9 @@ long kvm_arch_vm_ioctl(struct file *filp,
r = -EFAULT; r = -EFAULT;
if (copy_from_user(&control, argp, sizeof(control))) if (copy_from_user(&control, argp, sizeof(control)))
goto out; goto out;
r = -ENXIO;
if (!kvm->arch.vpit)
goto out;
r = kvm_vm_ioctl_reinject(kvm, &control); r = kvm_vm_ioctl_reinject(kvm, &control);
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment