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>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1252047619-2924-1-git-send-email-dfeng@redhat.com>
Date:	Fri,  4 Sep 2009 15:00:19 +0800
From:	Xiaotian Feng <dfeng@...hat.com>
To:	len.brown@...el.com, rui.zhang@...el.com, yakui.zhao@...el.com,
	bjorn.helgaas@...com, ak@...ux.intel.com
Cc:	linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org,
	Xiaotian Feng <dfeng@...hat.com>
Subject: [PATCH] drivers/acpi: fix memory leak in acpi_device_set_id

In acpi_device_set_id, if cid_list is allocated by ACPI_ALLOCATE_ZEROED,
it is never freed. This patch fixes the memory leak. 

Signed-off-by: Xiaotian Feng <dfeng@...hat.com>
---
 drivers/acpi/scan.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 781435d..a0102ad 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1010,6 +1010,7 @@ static void acpi_device_set_id(struct acpi_device *device,
 	struct acpi_compatible_id_list *cid_list = NULL;
 	const char *cid_add = NULL;
 	acpi_status status;
+	int free_cid_list = 0;
 
 	switch (type) {
 	case ACPI_BUS_TYPE_DEVICE:
@@ -1098,6 +1099,7 @@ static void acpi_device_set_id(struct acpi_device *device,
 				kfree(buffer.pointer);
 				return;
 			} else {
+				free_cid_list = 1;
 				cid_list->count = 0;
 				cid_list->size = size;
 			}
@@ -1124,6 +1126,8 @@ static void acpi_device_set_id(struct acpi_device *device,
 			printk(KERN_ERR PREFIX "Memory allocation error\n");
 	}
 
+	if (free_cid_list)
+		ACPI_FREE(cid_list);
 	kfree(buffer.pointer);
 }
 
-- 
1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ