Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231904

[PATCH 1/3] ACPI / EC: Fix a memory leak issue in acpi_ec_query()

From Lv Zheng <lv.zheng@intel.com>
Newsgroups linux.kernel
Subject [PATCH 1/3] ACPI / EC: Fix a memory leak issue in acpi_ec_query()
Date 2015-09-24 09:00 +0200
Message-ID <qc8FB-3Sb-27@gated-at.bofh.it> (permalink)
References <qc8FA-3Sb-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When query handler is not found, "result" is actually stil 0, and
"struct acpi_ec_query" is not NULL, so the deletion code of
"struct acpi_ec_query" at the end of the function cannot be invoked.
As a consequence, memory leak can be observed.

The issue is introduced by this commit:
  Commit: 02b771b64b73226052d6e731a0987db3b47281e9
  Subject: ACPI / EC: Fix an issue caused by the serialized _Qxx

This patch fixes such memory leakage.

Cc: stable@vger.kernel.org  # 4.3.1+
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
---
 drivers/acpi/ec.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 2614a83..42c66b6 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1044,8 +1044,10 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 *data)
 		goto err_exit;
 
 	mutex_lock(&ec->mutex);
+	result = -ENODATA;
 	list_for_each_entry(handler, &ec->list, node) {
 		if (value == handler->query_bit) {
+			result = 0;
 			q->handler = acpi_ec_get_query_handler(handler);
 			ec_dbg_evt("Query(0x%02x) scheduled",
 				   q->handler->query_bit);
-- 
1.7.10

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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] ACPI / EC: Fix several code coverity issues Lv Zheng <lv.zheng@intel.com> - 2015-09-24 09:00 +0200
  [PATCH 2/3] ACPI / EC: Fix query handler related issues Lv Zheng <lv.zheng@intel.com> - 2015-09-24 09:00 +0200
  [PATCH 1/3] ACPI / EC: Fix a memory leak issue in acpi_ec_query() Lv Zheng <lv.zheng@intel.com> - 2015-09-24 09:00 +0200
  Re: [PATCH 0/3] ACPI / EC: Fix several code coverity issues "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-05 22:20 +0200

csiph-web