aboutsummaryrefslogtreecommitdiffstats
path: root/virt
diff options
context:
space:
mode:
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/assigned-dev.c6
-rw-r--r--virt/kvm/kvm_main.c9
2 files changed, 9 insertions, 6 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index fd9c097b760a..f73de631e3ee 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -508,8 +508,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
508 struct kvm_assigned_dev_kernel *match; 508 struct kvm_assigned_dev_kernel *match;
509 struct pci_dev *dev; 509 struct pci_dev *dev;
510 510
511 down_read(&kvm->slots_lock);
512 mutex_lock(&kvm->lock); 511 mutex_lock(&kvm->lock);
512 down_read(&kvm->slots_lock);
513 513
514 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, 514 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
515 assigned_dev->assigned_dev_id); 515 assigned_dev->assigned_dev_id);
@@ -573,8 +573,8 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
573 } 573 }
574 574
575out: 575out:
576 mutex_unlock(&kvm->lock);
577 up_read(&kvm->slots_lock); 576 up_read(&kvm->slots_lock);
577 mutex_unlock(&kvm->lock);
578 return r; 578 return r;
579out_list_del: 579out_list_del:
580 list_del(&match->list); 580 list_del(&match->list);
@@ -585,8 +585,8 @@ out_put:
585 pci_dev_put(dev); 585 pci_dev_put(dev);
586out_free: 586out_free:
587 kfree(match); 587 kfree(match);
588 mutex_unlock(&kvm->lock);
589 up_read(&kvm->slots_lock); 588 up_read(&kvm->slots_lock);
589 mutex_unlock(&kvm->lock);
590 return r; 590 return r;
591} 591}
592 592
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e1f2bf8d7b1e..a944be392d6e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -64,7 +64,7 @@ MODULE_LICENSE("GPL");
64/* 64/*
65 * Ordering of locks: 65 * Ordering of locks:
66 * 66 *
67 * kvm->slots_lock --> kvm->lock --> kvm->irq_lock 67 * kvm->lock --> kvm->slots_lock --> kvm->irq_lock
68 */ 68 */
69 69
70DEFINE_SPINLOCK(kvm_lock); 70DEFINE_SPINLOCK(kvm_lock);
@@ -406,8 +406,11 @@ static struct kvm *kvm_create_vm(void)
406out: 406out:
407 return kvm; 407 return kvm;
408 408
409#if defined(KVM_COALESCED_MMIO_PAGE_OFFSET) || \
410 (defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER))
409out_err: 411out_err:
410 hardware_disable_all(); 412 hardware_disable_all();
413#endif
411out_err_nodisable: 414out_err_nodisable:
412 kfree(kvm); 415 kfree(kvm);
413 return ERR_PTR(r); 416 return ERR_PTR(r);
@@ -1177,7 +1180,7 @@ static struct file_operations kvm_vcpu_fops = {
1177 */ 1180 */
1178static int create_vcpu_fd(struct kvm_vcpu *vcpu) 1181static int create_vcpu_fd(struct kvm_vcpu *vcpu)
1179{ 1182{
1180 return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, 0); 1183 return anon_inode_getfd("kvm-vcpu", &kvm_vcpu_fops, vcpu, O_RDWR);
1181} 1184}
1182 1185
1183/* 1186/*
@@ -1638,7 +1641,7 @@ static int kvm_dev_ioctl_create_vm(void)
1638 kvm = kvm_create_vm(); 1641 kvm = kvm_create_vm();
1639 if (IS_ERR(kvm)) 1642 if (IS_ERR(kvm))
1640 return PTR_ERR(kvm); 1643 return PTR_ERR(kvm);
1641 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, 0); 1644 fd = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR);
1642 if (fd < 0) 1645 if (fd < 0)
1643 kvm_put_kvm(kvm); 1646 kvm_put_kvm(kvm);
1644 1647