Commit bb742ad0 authored by Zhang Qilong's avatar Zhang Qilong Committed by Alex Williamson
Browse files

vfio: platform: fix reference leak in vfio_platform_open



pm_runtime_get_sync() will increment pm usage counter even it
failed. Forgetting to call pm_runtime_put will result in
reference leak in vfio_platform_open, so we should fix it.

Signed-off-by: default avatarZhang Qilong <zhangqilong3@huawei.com>
Acked-by: default avatarEric Auger <eric.auger@redhat.com>
Signed-off-by: default avatarAlex Williamson <alex.williamson@redhat.com>
parent 38565c93
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data)

		ret = pm_runtime_get_sync(vdev->device);
		if (ret < 0)
			goto err_pm;
			goto err_rst;

		ret = vfio_platform_call_reset(vdev, &extra_dbg);
		if (ret && vdev->reset_required) {
@@ -284,7 +284,6 @@ static int vfio_platform_open(void *device_data)

err_rst:
	pm_runtime_put(vdev->device);
err_pm:
	vfio_platform_irq_cleanup(vdev);
err_irq:
	vfio_platform_regions_cleanup(vdev);