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


Groups > linux.kernel > #1478090 > unrolled thread

[PATCH v2 0/4] ACPI / EC: Fix ECDT and boot_ec support

Started byLv Zheng <lv.zheng@intel.com>
First post2016-09-07 11:00 +0200
Last post2016-09-07 11:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 0/4] ACPI / EC: Fix ECDT and boot_ec support Lv Zheng <lv.zheng@intel.com> - 2016-09-07 11:00 +0200
    [PATCH v2 2/4] ACPI / EC: Fix a memory leakage issue in acpi_ec_add() Lv Zheng <lv.zheng@intel.com> - 2016-09-07 11:00 +0200

#1478090 — [PATCH v2 0/4] ACPI / EC: Fix ECDT and boot_ec support

FromLv Zheng <lv.zheng@intel.com>
Date2016-09-07 11:00 +0200
Subject[PATCH v2 0/4] ACPI / EC: Fix ECDT and boot_ec support
Message-ID<seGS5-5U1-9@gated-at.bofh.it>
Linux uses ECDT only in boot stage (before the namespace is fully
initialized), but there are cases reported that Windows allows ECDT to be
used for OSPM runtime, responding EC events by evaluating _Qxx methods
under the device node indicated in the ECDT.

This patchset changes Linux ECDT support to follow Windows behavior and
also fixes related boot_ec support.

v2:
 Rebased on top of recent linux-pm.git/linux-next.
 Addressed 1 comment from Peter Wu.
 Update patch SOBs.

Lv Zheng (4):
  ACPI / EC: Cleanup first_ec/boot_ec code
  ACPI / EC: Fix a memory leakage issue in acpi_ec_add()
  ACPI / EC: Fix a gap that ECDT EC cannot handle EC events
  ACPI / EC: Fix issues related to boot_ec

 drivers/acpi/ec.c       |  240 +++++++++++++++++++++++++++++++++++++----------
 drivers/acpi/internal.h |    1 +
 drivers/acpi/scan.c     |    1 +
 3 files changed, 195 insertions(+), 47 deletions(-)

-- 
1.7.10

[toc] | [next] | [standalone]


#1478092 — [PATCH v2 2/4] ACPI / EC: Fix a memory leakage issue in acpi_ec_add()

FromLv Zheng <lv.zheng@intel.com>
Date2016-09-07 11:00 +0200
Subject[PATCH v2 2/4] ACPI / EC: Fix a memory leakage issue in acpi_ec_add()
Message-ID<seGS5-5U1-19@gated-at.bofh.it>
In reply to#1478090
When the handler installation failed, there was no code to free the
allocated EC device. This patch fixes this memory leakage issue.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=115021
Reported-and-tested-by: Luya Tshimbalanga <luya@fedoraproject.org>
Tested-by: Jonh Henderson <jw.hendy@gmail.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Cc: Peter Wu <peter@lekensteyn.nl>
---
 drivers/acpi/ec.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 9eab651..50895ff 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -1513,14 +1513,18 @@ static int acpi_ec_add(struct acpi_device *device)
 		return -ENOMEM;
 	if (ec_parse_device(device->handle, 0, ec, NULL) !=
 		AE_CTRL_TERMINATE) {
-			acpi_ec_free(ec);
-			return -EINVAL;
+			ret = -EINVAL;
+			goto err_alloc;
 	}
 
 	/* Find and register all query methods */
 	acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1,
 			    acpi_ec_register_query_methods, NULL, ec, NULL);
 
+	ret = acpi_config_boot_ec(ec, false);
+	if (ret)
+		goto err_query;
+
 	device->driver_data = ec;
 
 	ret = !!request_region(ec->data_addr, 1, "EC data");
@@ -1528,13 +1532,17 @@ static int acpi_ec_add(struct acpi_device *device)
 	ret = !!request_region(ec->command_addr, 1, "EC cmd");
 	WARN(!ret, "Could not request EC cmd io port 0x%lx", ec->command_addr);
 
-	ret = acpi_config_boot_ec(ec, false);
-
 	/* Reprobe devices depending on the EC */
 	acpi_walk_dep_device_list(ec->handle);
 
 	/* EC is fully operational, allow queries */
 	acpi_ec_enable_event(ec);
+	return 0;
+
+err_query:
+	acpi_ec_remove_query_handlers(ec, true, 0);
+err_alloc:
+	acpi_ec_free(ec);
 	return ret;
 }
 
-- 
1.7.10

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web