mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
[ Upstream commit 4ddf4739be6e375116c375f0a68bf3893ffcee21 ] 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 "b8eb718348" fixed a similar problem. Fixes:0bb549052d("efi: Add esrt support") Signed-off-by: Qiushi Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
8c236ac437
commit
92444a57e3
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue