public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: fix one UAF issue
@ 2023-01-12  7:05 korantwork
  0 siblings, 0 replies; only message in thread
From: korantwork @ 2023-01-12  7:05 UTC (permalink / raw)
  To: ardb, sudeep.holla, cristian.marussi; +Cc: linux-kernel, Xinghui Li, loydlv

From: Xinghui Li <korantli@tencent.com>

There could be the use after free issue in dmi_sysfs_register_handle.
During handling specializations process, the entry->child could be
free if the error occurs. However, it will be kobject_put after free.
So, we set the entry->child to NULL to avoid above case.

Reported-by: loydlv <loydlv@tencent.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
---
 drivers/firmware/dmi-sysfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index 66727ad3361b..dd4ff5f7e200 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -470,6 +470,7 @@ static int dmi_system_event_log(struct dmi_sysfs_entry *entry)
 	kobject_del(entry->child);
 out_free:
 	kfree(entry->child);
+	entry->child = NULL;
 	return ret;
 }
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-01-12  7:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-12  7:05 [PATCH] firmware: fix one UAF issue korantwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox