aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d9bbb20f230f..29a667ce35b0 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -466,6 +466,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
466 struct kvm_assigned_dev_kernel *match; 466 struct kvm_assigned_dev_kernel *match;
467 struct pci_dev *dev; 467 struct pci_dev *dev;
468 468
469 down_read(&kvm->slots_lock);
469 mutex_lock(&kvm->lock); 470 mutex_lock(&kvm->lock);
470 471
471 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head, 472 match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
@@ -527,6 +528,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
527 528
528out: 529out:
529 mutex_unlock(&kvm->lock); 530 mutex_unlock(&kvm->lock);
531 up_read(&kvm->slots_lock);
530 return r; 532 return r;
531out_list_del: 533out_list_del:
532 list_del(&match->list); 534 list_del(&match->list);
@@ -538,6 +540,7 @@ out_put:
538out_free: 540out_free:
539 kfree(match); 541 kfree(match);
540 mutex_unlock(&kvm->lock); 542 mutex_unlock(&kvm->lock);
543 up_read(&kvm->slots_lock);
541 return r; 544 return r;
542} 545}
543#endif 546#endif