lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 22 Mar 2021 06:30:39 -0700
From:   Lv Yunlong <lyl2019@...l.ustc.edu.cn>
To:     akpm@...ux-foundation.org
Cc:     linux-kernel@...r.kernel.org, Lv Yunlong <lyl2019@...l.ustc.edu.cn>
Subject: [PATCH] firmware/dmi-sysfs: Fix a double free in dmi_sysfs_register_handle

In the case of DMI_ENTRY_SYSTEM_EVENT_LOG, it calls
dmi_system_event_log(entry). If dmi_system_event_log()
failed, it will free the entry->child and return err.

But in the out_err branch, the entry->child will be freed
again. My patch adds a new label "out_err1" to avoid freeing
entry->child twice.

Signed-off-by: Lv Yunlong <lyl2019@...l.ustc.edu.cn>
---
 drivers/firmware/dmi-sysfs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/dmi-sysfs.c b/drivers/firmware/dmi-sysfs.c
index 8b8127fa8955..fd498f2037a8 100644
--- a/drivers/firmware/dmi-sysfs.c
+++ b/drivers/firmware/dmi-sysfs.c
@@ -622,16 +622,17 @@ static void __init dmi_sysfs_register_handle(const struct dmi_header *dh,
 		break;
 	}
 	if (*ret)
-		goto out_err;
+		goto out_err1;
 
 	/* Create the raw binary file to access the entry */
 	*ret = sysfs_create_bin_file(&entry->kobj, &dmi_entry_raw_attr);
 	if (*ret)
-		goto out_err;
+		goto out_err2;
 
 	return;
-out_err:
+out_err2:
 	kobject_put(entry->child);
+out_err1:
 	kobject_put(&entry->kobj);
 	return;
 }
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ