* [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open
@ 2020-10-31 3:03 Zhang Qilong
2020-11-02 9:08 ` Auger Eric
2020-11-03 18:21 ` Alex Williamson
0 siblings, 2 replies; 3+ messages in thread
From: Zhang Qilong @ 2020-10-31 3:03 UTC (permalink / raw)
To: eric.auger, alex.williamson; +Cc: cohuck, kvm
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>
---
drivers/vfio/platform/vfio_platform_common.c | 3 +--
1 file changed, 1 insertion(+), 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);
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open
2020-10-31 3:03 [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open Zhang Qilong
@ 2020-11-02 9:08 ` Auger Eric
2020-11-03 18:21 ` Alex Williamson
1 sibling, 0 replies; 3+ messages in thread
From: Auger Eric @ 2020-11-02 9:08 UTC (permalink / raw)
To: Zhang Qilong, alex.williamson; +Cc: cohuck, kvm
Hi Zhang,
On 10/31/20 4:03 AM, Zhang Qilong wrote:
> 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>
Looks good to me,
Acked-by: Eric Auger <eric.auger@redhat.com>
Thank you for the fix
Eric
> ---
> drivers/vfio/platform/vfio_platform_common.c | 3 +--
> 1 file changed, 1 insertion(+), 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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open
2020-10-31 3:03 [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open Zhang Qilong
2020-11-02 9:08 ` Auger Eric
@ 2020-11-03 18:21 ` Alex Williamson
1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2020-11-03 18:21 UTC (permalink / raw)
To: Zhang Qilong; +Cc: eric.auger, cohuck, kvm
On Sat, 31 Oct 2020 11:03:53 +0800
Zhang Qilong <zhangqilong3@huawei.com> wrote:
> 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>
> ---
> drivers/vfio/platform/vfio_platform_common.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Applied to vfio for-linus branch with Eric's ack for v5.10. Thanks,
Alex
> 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);
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-03 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-31 3:03 [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open Zhang Qilong
2020-11-02 9:08 ` Auger Eric
2020-11-03 18:21 ` Alex Williamson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).