[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <159258516116.16989.8861794799780746697.tip-bot2@tip-bot2>
Date: Fri, 19 Jun 2020 16:46:01 -0000
From: "tip-bot2 for Qiushi Wu" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Qiushi Wu <wu000273@....edu>, Ard Biesheuvel <ardb@...nel.org>,
x86 <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [tip: efi/urgent] efi/esrt: Fix reference count leak in
esre_create_sysfs_entry.
The following commit has been merged into the efi/urgent branch of tip:
Commit-ID: 4ddf4739be6e375116c375f0a68bf3893ffcee21
Gitweb: https://git.kernel.org/tip/4ddf4739be6e375116c375f0a68bf3893ffcee21
Author: Qiushi Wu <wu000273@....edu>
AuthorDate: Thu, 28 May 2020 13:38:04 -05:00
Committer: Ard Biesheuvel <ardb@...nel.org>
CommitterDate: Mon, 15 Jun 2020 14:38:56 +02:00
efi/esrt: Fix reference count leak in esre_create_sysfs_entry.
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@....edu>
Link: https://lore.kernel.org/r/20200528183804.4497-1-wu000273@umn.edu
Signed-off-by: Ard Biesheuvel <ardb@...nel.org>
---
drivers/firmware/efi/esrt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
index e3d6926..d591527 100644
--- a/drivers/firmware/efi/esrt.c
+++ b/drivers/firmware/efi/esrt.c
@@ -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;
}
}
Powered by blists - more mailing lists