1
0
Fork 0

efi/esrt: Fix reference count leak in esre_create_sysfs_entry.

[ Upstream commit 4ddf4739be ]

kobject_init_and_add() takes reference even when it fails.
If this function returns an error, kobject_put() must be called to
properly clean up the memory associated with the object. Previous
commit "b8eb718348b8" fixed a similar problem.

Fixes: 0bb549052d ("efi: Add esrt support")
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Link: https://lore.kernel.org/r/20200528183804.4497-1-wu000273@umn.edu
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
5.4-rM2-2.2.x-imx-squashed
Qiushi Wu 2020-05-28 13:38:04 -05:00 committed by Sasha Levin
parent 8c236ac437
commit 92444a57e3
1 changed files with 1 additions and 1 deletions

View File

@ -181,7 +181,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
"entry%d", entry_num);
if (rc) {
kfree(entry);
kobject_put(&entry->kobj);
return rc;
}
}