lkml.org 
[lkml]   [2022]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] vfio: Fix memory leaks in vfio_create_group()
Date
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
\
 
 \ /
  Last update: 2022-06-29 04:06    [W:0.211 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site