vfio: Fix memory leaks in vfio_create_group()
Subsystems (2)
PATCH 1/1 vfio: Fix memory leaks in vfio_create_group()
If an error occurs after vfio_group_alloc(), we need to release the group.
Signed-off-by Lei Rao <[email protected]>
--- drivers/vfio/vfio.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/vfio.c +1 -0
@@ -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; }
Signature · 1 line
2.32.0
Quoted 16 lines
From: Rao, Lei <[email protected]>
Sent: Wednesday, June 29, 2022 10:05 AMIf an error occurs after
vfio_group_alloc(), we need to release the group.Signed-off-by Lei Rao <[email protected]>--- drivers/vfio/vfio.c | 1 + 1 file changed, 1 insertion(+)drivers/vfio/vfio.c +0
-0
drivers/vfio/vfio.c static struct vfio_group *vfio_create_group(struct · line 418
Quoted 5 lines
drivers/vfio/vfio.c +1
-0@@ -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().
Quoted 5 lines
drivers/vfio/vfio.c +0
-1return ret; } --2.32.0