* [PATCH] vfio: Fix memory leaks in vfio_create_group()
@ 2022-06-29 2:05 Lei Rao
2022-06-29 2:20 ` Tian, Kevin
0 siblings, 1 reply; 2+ messages in thread
From: Lei Rao @ 2022-06-29 2:05 UTC (permalink / raw)
To: alex.williamson, cohuck, kevin.tian, kvm, linux-kernel; +Cc: Lei Rao
If an error occurs after vfio_group_alloc(), we need to release the
group.
Signed-off-by: Lei Rao <lei.rao@intel.com>
---
drivers/vfio/vfio.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
index 61e71c1154be..2460aec44a6d 100644
--- a/drivers/vfio/vfio.c
+++ b/drivers/vfio/vfio.c
@@ -414,6 +414,7 @@ static struct vfio_group *vfio_create_group(struct iommu_group *iommu_group,
mutex_unlock(&vfio.group_lock);
err_put:
put_device(&group->dev);
+ vfio_group_release(&group->dev);
return ret;
}
--
2.32.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [PATCH] vfio: Fix memory leaks in vfio_create_group()
2022-06-29 2:05 [PATCH] vfio: Fix memory leaks in vfio_create_group() Lei Rao
@ 2022-06-29 2:20 ` Tian, Kevin
0 siblings, 0 replies; 2+ messages in thread
From: Tian, Kevin @ 2022-06-29 2:20 UTC (permalink / raw)
To: Rao, Lei, alex.williamson, cohuck, kvm, linux-kernel
> From: Rao, Lei <lei.rao@intel.com>
> Sent: Wednesday, June 29, 2022 10:05 AM
>
> If an error occurs after vfio_group_alloc(), we need to release the
> group.
>
> Signed-off-by: Lei Rao <lei.rao@intel.com>
> ---
> drivers/vfio/vfio.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/vfio/vfio.c b/drivers/vfio/vfio.c
> index 61e71c1154be..2460aec44a6d 100644
> --- a/drivers/vfio/vfio.c
> +++ b/drivers/vfio/vfio.c
> @@ -414,6 +414,7 @@ static struct vfio_group *vfio_create_group(struct
> iommu_group *iommu_group,
> mutex_unlock(&vfio.group_lock);
> err_put:
> put_device(&group->dev);
> + vfio_group_release(&group->dev);
this is called automatically by put_device().
> return ret;
> }
>
> --
> 2.32.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-06-29 2:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 2:05 [PATCH] vfio: Fix memory leaks in vfio_create_group() Lei Rao
2022-06-29 2:20 ` Tian, Kevin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.