diff options
author | Zhang Qilong <zhangqilong3@huawei.com> | 2020-10-31 11:03:53 +0800 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2020-11-03 11:07:40 -0700 |
commit | bb742ad01961a3b9d1f9d19375487b879668b6b2 (patch) | |
tree | 70641145617ec44524867375c5642f4c140c323e /drivers/vfio | |
parent | 38565c93c8a1306dc5f245572a545fbea908ac41 (diff) | |
download | linux-bb742ad01961a3b9d1f9d19375487b879668b6b2.tar.bz2 |
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: Zhang Qilong <zhangqilong3@huawei.com>
Acked-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/platform/vfio_platform_common.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c index c0771a9567fb..fb4b385191f2 100644 --- a/drivers/vfio/platform/vfio_platform_common.c +++ b/drivers/vfio/platform/vfio_platform_common.c @@ -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); |