Skip to content

Commit

Permalink
vfio: platform: fix reference leak in vfio_platform_open
Browse files Browse the repository at this point in the history
[ Upstream commit bb742ad ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zhang Qilong authored and gregkh committed Nov 18, 2020
1 parent e68d368 commit 0fa7baa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/vfio/platform/vfio_platform_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit 0fa7baa

Please sign in to comment.