Re: [PATCH] vfio: platform: fix reference leak in vfio_platform_open

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Zhang,

On 10/30/20 4:47 PM, Zhang Qilong wrote:
> pm_runtime_get_sync() will increment pm usage counter even it
> failed. Forgetting to call pm_runtime_put_noidle will result
> in reference leak in vfio_platform_open, so we should fix it.
> 
> Signed-off-by: Zhang Qilong <zhangqilong3@xxxxxxxxxx>
> ---
>  drivers/vfio/platform/vfio_platform_common.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/vfio/platform/vfio_platform_common.c b/drivers/vfio/platform/vfio_platform_common.c
> index c0771a9567fb..aa97f1678981 100644
> --- a/drivers/vfio/platform/vfio_platform_common.c
> +++ b/drivers/vfio/platform/vfio_platform_common.c
> @@ -266,8 +266,10 @@ static int vfio_platform_open(void *device_data)
>  			goto err_irq;
>  
>  		ret = pm_runtime_get_sync(vdev->device);
> -		if (ret < 0)
> +		if (ret < 0) {
> +			pm_runtime_put_noidle(vdev->device);
can't we jump to err_rst then?

Thanks

Eric
>  			goto err_pm;
> +		}
>  
>  		ret = vfio_platform_call_reset(vdev, &extra_dbg);
>  		if (ret && vdev->reset_required) {
> 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux