Thread (3 messages) 3 messages, 2 authors, 2020-11-27

Re: [PATCH v2] acpi: Fix use-after-free in acpi_ipmi.c

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2020-11-26 14:22:43
Also in: lkml

On Thu, Nov 26, 2020 at 2:26 AM Youling Tang [off-list ref] wrote:
quoted hunk ↗ jump to hunk
kfree() has been called inside put_device so anther kfree would cause a
use-after-free bug.

Signed-off-by: Youling Tang <redacted>
---
 drivers/acpi/acpi_ipmi.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c
index 9d6c0fc..18edf8b 100644
--- a/drivers/acpi/acpi_ipmi.c
+++ b/drivers/acpi/acpi_ipmi.c
@@ -142,7 +142,6 @@ static void ipmi_dev_release(struct acpi_ipmi_device *ipmi_device)
 {
        ipmi_destroy_user(ipmi_device->user_interface);
        put_device(ipmi_device->dev);
Does putting ipmi_device->dev (which is a different object than
ipmi_device itself) really cause ipmi_device to be freed
automatically?  If not, the change below will introduce a memory leak.
-       kfree(ipmi_device);
 }

 static void ipmi_dev_release_kref(struct kref *kref)
--
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help