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]
Date:   Fri,  7 Jul 2017 09:39:59 +0100
From:   Marc Zyngier <marc.zyngier@....com>
To:     linux-kernel@...r.kernel.org
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Hanjun Guo <hanjun.guo@...aro.org>,
        Agustin Vega-Frias <agustinv@...eaurora.org>,
        Ma Jun <majun258@...wei.com>,
        John Garry <john.garry@...wei.com>
Subject: [PATCH] irqdomain: Allow ACPI device nodes to be used as irqdomain identifiers

A number of irqchip implementations are (ab)using the irqdomain
allocator by passing a fwnode that is neither a FWNODE_OF or
a FWNODE_IRQCHIP.

This is pretty bad, but it also feels pretty crap to force these
drivers to allocate their own irqchip_fwid when they already have
a proper fwnode.

Instead, let's teach the irqdomain allocator about ACPI device
nodes, and add some lovely name generation code... Tested on
an arm64 D05 system.

Reported-by: John Garry <john.garry@...wei.com>
Signed-off-by: Marc Zyngier <marc.zyngier@....com>
---
 kernel/irq/irqdomain.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 14fe862aa2e3..71ed8a849345 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1,5 +1,6 @@
 #define pr_fmt(fmt)  "irq: " fmt
 
+#include <linux/acpi.h>
 #include <linux/debugfs.h>
 #include <linux/hardirq.h>
 #include <linux/interrupt.h>
@@ -155,6 +156,21 @@ struct irq_domain *__irq_domain_add(struct fwnode_handle *fwnode, int size,
 			domain->name = fwid->name;
 			break;
 		}
+#ifdef CONFIG_ACPI
+	} else if (is_acpi_device_node(fwnode)) {
+		struct acpi_buffer buf = {
+			.length = ACPI_ALLOCATE_BUFFER,
+		};
+		acpi_handle handle;
+
+		handle = acpi_device_handle(to_acpi_device_node(fwnode));
+		if (acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf) == AE_OK) {
+			domain->name = buf.pointer;
+			domain->flags |= IRQ_DOMAIN_NAME_ALLOCATED;
+		}
+
+		domain->fwnode = fwnode;
+#endif
 	} else if (of_node) {
 		char *name;
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ