mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-04 01:56:40 +07:00
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: d72e31c937
("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>
This commit is contained in:
parent
ed3119e455
commit
7cc3161373
@ -510,7 +510,7 @@ struct iommu_group *iommu_group_alloc(void)
|
||||
NULL, "%d", group->id);
|
||||
if (ret) {
|
||||
ida_simple_remove(&iommu_group_ida, group->id);
|
||||
kfree(group);
|
||||
kobject_put(&group->kobj);
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user