Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Zhang Qilong <zhangqilong3@huawei.com>
Cc: <eric.auger@redhat.com>, <cohuck@redhat.com>, <kvm@vger.kernel.org>
Subject: Re: [PATCH v2] vfio: platform: fix reference leak in vfio_platform_open
Date: Tue, 3 Nov 2020 11:21:04 -0700	[thread overview]
Message-ID: <20201103112104.57e8eea1@w520.home> (raw)
In-Reply-To: <20201031030353.9699-1-zhangqilong3@huawei.com>

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);


      parent reply	other threads:[~2020-11-03 18:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201103112104.57e8eea1@w520.home \
    --to=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=zhangqilong3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox