KVM: Add infrastructure and macro to mark VM as bugged
[linux-2.6-microblaze.git] / virt / kvm / kvm_main.c
index d20fba0..965c51a 100644 (file)
@@ -3598,7 +3598,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
        struct kvm_fpu *fpu = NULL;
        struct kvm_sregs *kvm_sregs = NULL;
 
-       if (vcpu->kvm->mm != current->mm)
+       if (vcpu->kvm->mm != current->mm || vcpu->kvm->vm_bugged)
                return -EIO;
 
        if (unlikely(_IOC_TYPE(ioctl) != KVMIO))
@@ -3808,7 +3808,7 @@ static long kvm_vcpu_compat_ioctl(struct file *filp,
        void __user *argp = compat_ptr(arg);
        int r;
 
-       if (vcpu->kvm->mm != current->mm)
+       if (vcpu->kvm->mm != current->mm || vcpu->kvm->vm_bugged)
                return -EIO;
 
        switch (ioctl) {
@@ -3874,7 +3874,7 @@ static long kvm_device_ioctl(struct file *filp, unsigned int ioctl,
 {
        struct kvm_device *dev = filp->private_data;
 
-       if (dev->kvm->mm != current->mm)
+       if (dev->kvm->mm != current->mm || dev->kvm->vm_bugged)
                return -EIO;
 
        switch (ioctl) {
@@ -4196,7 +4196,7 @@ static long kvm_vm_ioctl(struct file *filp,
        void __user *argp = (void __user *)arg;
        int r;
 
-       if (kvm->mm != current->mm)
+       if (kvm->mm != current->mm || kvm->vm_bugged)
                return -EIO;
        switch (ioctl) {
        case KVM_CREATE_VCPU:
@@ -4407,7 +4407,7 @@ static long kvm_vm_compat_ioctl(struct file *filp,
        struct kvm *kvm = filp->private_data;
        int r;
 
-       if (kvm->mm != current->mm)
+       if (kvm->mm != current->mm || kvm->vm_bugged)
                return -EIO;
        switch (ioctl) {
 #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT