mirror of https://gitee.com/openkylin/linux.git
vfio: platform: Fix reset module leak in error path
If the IOMMU group setup fails, the reset module is not released.
Fixes: b5add544d6
("vfio, platform: make reset driver a requirement by default")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Acked-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This commit is contained in:
parent
a5e6e6505f
commit
28a6838788
|
@ -681,18 +681,23 @@ int vfio_platform_probe_common(struct vfio_platform_device *vdev,
|
||||||
group = vfio_iommu_group_get(dev);
|
group = vfio_iommu_group_get(dev);
|
||||||
if (!group) {
|
if (!group) {
|
||||||
pr_err("VFIO: No IOMMU group for device %s\n", vdev->name);
|
pr_err("VFIO: No IOMMU group for device %s\n", vdev->name);
|
||||||
return -EINVAL;
|
ret = -EINVAL;
|
||||||
|
goto put_reset;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vfio_add_group_dev(dev, &vfio_platform_ops, vdev);
|
ret = vfio_add_group_dev(dev, &vfio_platform_ops, vdev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
vfio_iommu_group_put(group, dev);
|
goto put_iommu;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
mutex_init(&vdev->igate);
|
mutex_init(&vdev->igate);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
put_iommu:
|
||||||
|
vfio_iommu_group_put(group, dev);
|
||||||
|
put_reset:
|
||||||
|
vfio_platform_put_reset(vdev);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(vfio_platform_probe_common);
|
EXPORT_SYMBOL_GPL(vfio_platform_probe_common);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue