diff options
author | Qiushi Wu <wu000273@umn.edu> | 2020-05-28 13:38:04 -0500 |
---|---|---|
committer | Sasha Levin <sashal@kernel.org> | 2020-06-30 15:38:42 -0400 |
commit | 83fc0cb8db7adf36a75f6cf55820ee386721bd1b (patch) | |
tree | 4ee020f4b29cc2662e818a1922cf42811d37933c /drivers/firmware | |
parent | 7e2632caa9b4591aa82fbba57f3b927552545f92 (diff) | |
download | linux-stable-83fc0cb8db7adf36a75f6cf55820ee386721bd1b.tar.gz linux-stable-83fc0cb8db7adf36a75f6cf55820ee386721bd1b.tar.bz2 linux-stable-83fc0cb8db7adf36a75f6cf55820ee386721bd1b.zip |
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 "b8eb718348b8" fixed a similar problem.
Fixes: 0bb549052d33 ("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>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/efi/esrt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c index 241dd7c63d2c..481b2f0a190b 100644 --- a/drivers/firmware/efi/esrt.c +++ b/drivers/firmware/efi/esrt.c @@ -180,7 +180,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; } } |