Skip to content

Commit 7cc3161

Browse files
QiushiWujoergroedel
authored andcommitted
iommu: Fix reference count leak in iommu_group_alloc.
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: d72e31c ("iommu: IOMMU Groups") Signed-off-by: Qiushi Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent ed3119e commit 7cc3161

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iommu/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ struct iommu_group *iommu_group_alloc(void)
510510
NULL, "%d", group->id);
511511
if (ret) {
512512
ida_simple_remove(&iommu_group_ida, group->id);
513-
kfree(group);
513+
kobject_put(&group->kobj);
514514
return ERR_PTR(ret);
515515
}
516516

0 commit comments

Comments
 (0)