aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm/coalesced_mmio.c
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm/coalesced_mmio.c')
-rw-r--r--virt/kvm/coalesced_mmio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 397f41936698..b40946c1237d 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -115,16 +115,16 @@ int kvm_vm_ioctl_register_coalesced_mmio(struct kvm *kvm,
115 if (dev == NULL) 115 if (dev == NULL)
116 return -EINVAL; 116 return -EINVAL;
117 117
118 mutex_lock(&kvm->lock); 118 down_write(&kvm->slots_lock);
119 if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) { 119 if (dev->nb_zones >= KVM_COALESCED_MMIO_ZONE_MAX) {
120 mutex_unlock(&kvm->lock); 120 up_write(&kvm->slots_lock);
121 return -ENOBUFS; 121 return -ENOBUFS;
122 } 122 }
123 123
124 dev->zone[dev->nb_zones] = *zone; 124 dev->zone[dev->nb_zones] = *zone;
125 dev->nb_zones++; 125 dev->nb_zones++;
126 126
127 mutex_unlock(&kvm->lock); 127 up_write(&kvm->slots_lock);
128 return 0; 128 return 0;
129} 129}
130 130
@@ -138,7 +138,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
138 if (dev == NULL) 138 if (dev == NULL)
139 return -EINVAL; 139 return -EINVAL;
140 140
141 mutex_lock(&kvm->lock); 141 down_write(&kvm->slots_lock);
142 142
143 i = dev->nb_zones; 143 i = dev->nb_zones;
144 while(i) { 144 while(i) {
@@ -156,7 +156,7 @@ int kvm_vm_ioctl_unregister_coalesced_mmio(struct kvm *kvm,
156 i--; 156 i--;
157 } 157 }
158 158
159 mutex_unlock(&kvm->lock); 159 up_write(&kvm->slots_lock);
160 160
161 return 0; 161 return 0;
162} 162}