1 From foo@baz Sat Jul 28 10:25:26 CEST 2018
2 From: Geert Uytterhoeven <geert+renesas@glider.be>
3 Date: Wed, 11 Apr 2018 11:15:48 +0200
4 Subject: vfio: platform: Fix reset module leak in error path
6 From: Geert Uytterhoeven <geert+renesas@glider.be>
8 [ Upstream commit 28a68387888997e8a7fa57940ea5d55f2e16b594 ]
10 If the IOMMU group setup fails, the reset module is not released.
12 Fixes: b5add544d677d363 ("vfio, platform: make reset driver a requirement by default")
13 Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
14 Reviewed-by: Eric Auger <eric.auger@redhat.com>
15 Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
16 Acked-by: Eric Auger <eric.auger@redhat.com>
17 Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
18 Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 drivers/vfio/platform/vfio_platform_common.c | 15 ++++++++++-----
22 1 file changed, 10 insertions(+), 5 deletions(-)
24 --- a/drivers/vfio/platform/vfio_platform_common.c
25 +++ b/drivers/vfio/platform/vfio_platform_common.c
26 @@ -681,18 +681,23 @@ int vfio_platform_probe_common(struct vf
27 group = vfio_iommu_group_get(dev);
29 pr_err("VFIO: No IOMMU group for device %s\n", vdev->name);
35 ret = vfio_add_group_dev(dev, &vfio_platform_ops, vdev);
37 - vfio_iommu_group_put(group, dev);
43 mutex_init(&vdev->igate);
48 + vfio_iommu_group_put(group, dev);
50 + vfio_platform_put_reset(vdev);
53 EXPORT_SYMBOL_GPL(vfio_platform_probe_common);