summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/iommu.c
diff options
context:
space:
mode:
authorQiushi Wu <wu000273@umn.edu>2020-05-27 16:00:19 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-06-03 08:12:12 +0200
commit2996897d8b9bf1b42919300f392a891b4f925480 (patch)
tree9bbf0129fdf1fc9208743f53e283e6f6ffad4756 /drivers/iommu/iommu.c
parente8457f2a32a427c56aa3724cdca4e472685303f0 (diff)
downloadlinux-stable-2996897d8b9bf1b42919300f392a891b4f925480.tar.gz
linux-stable-2996897d8b9bf1b42919300f392a891b4f925480.tar.bz2
linux-stable-2996897d8b9bf1b42919300f392a891b4f925480.zip
iommu: Fix reference count leak in iommu_group_alloc.
[ Upstream commit 7cc31613734c4870ae32f5265d576ef296621343 ] kobject_init_and_add() takes reference even when it fails. Thus, when kobject_init_and_add() returns an error, kobject_put() must be called to properly clean up the kobject. Fixes: d72e31c93746 ("iommu: IOMMU Groups") Signed-off-by: Qiushi Wu <wu000273@umn.edu> Link: https://lore.kernel.org/r/20200527210020.6522-1-wu000273@umn.edu Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/iommu/iommu.c')
-rw-r--r--drivers/iommu/iommu.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index 589207176ffa..a1e7a73930fa 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -206,7 +206,7 @@ again:
mutex_lock(&iommu_group_mutex);
ida_remove(&iommu_group_ida, group->id);
mutex_unlock(&iommu_group_mutex);
- kfree(group);
+ kobject_put(&group->kobj);
return ERR_PTR(ret);
}