|
@@ -1080,30 +1080,26 @@ static long vfio_ioctl_set_iommu(struct vfio_container *container,
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- /* module reference holds the driver we're working on */
|
|
|
- mutex_unlock(&vfio.iommu_drivers_lock);
|
|
|
-
|
|
|
data = driver->ops->open(arg);
|
|
|
if (IS_ERR(data)) {
|
|
|
ret = PTR_ERR(data);
|
|
|
module_put(driver->ops->owner);
|
|
|
- goto skip_drivers_unlock;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
ret = __vfio_container_attach_groups(container, driver, data);
|
|
|
- if (!ret) {
|
|
|
- container->iommu_driver = driver;
|
|
|
- container->iommu_data = data;
|
|
|
- } else {
|
|
|
+ if (ret) {
|
|
|
driver->ops->release(data);
|
|
|
module_put(driver->ops->owner);
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
- goto skip_drivers_unlock;
|
|
|
+ container->iommu_driver = driver;
|
|
|
+ container->iommu_data = data;
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
mutex_unlock(&vfio.iommu_drivers_lock);
|
|
|
-skip_drivers_unlock:
|
|
|
up_write(&container->group_lock);
|
|
|
|
|
|
return ret;
|