Skip to content

Commit bb742ad

Browse files
Zhang QilongAlex Williamson
authored andcommitted
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>
1 parent 38565c9 commit bb742ad

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/vfio/platform/vfio_platform_common.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ static int vfio_platform_open(void *device_data)
267267

268268
ret = pm_runtime_get_sync(vdev->device);
269269
if (ret < 0)
270-
goto err_pm;
270+
goto err_rst;
271271

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

285285
err_rst:
286286
pm_runtime_put(vdev->device);
287-
err_pm:
288287
vfio_platform_irq_cleanup(vdev);
289288
err_irq:
290289
vfio_platform_regions_cleanup(vdev);

0 commit comments

Comments
 (0)