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-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 May 2024 21:02:22 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: <tglx@...utronix.de>, <linux-kernel@...r.kernel.org>
CC: <ruanjinjie@...wei.com>
Subject: [PATCH 4/5] genirq/irqdomain: Simplify the checks for irq_domain_push/pop_irq()

Since whether desc is NULL or domain is NULL or irq_data is NULL, it
returns -EINVAL, check them together in irq_domain_push/pop_irq(). And
whether the irq domain is not hierarchy or it's parent domain is not
consistent, it returns -EINVAL, check them together too.

Signed-off-by: Jinjie Ruan <ruanjinjie@...wei.com>
---
 kernel/irq/irqdomain.c | 23 +++++------------------
 1 file changed, 5 insertions(+), 18 deletions(-)

diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 6d8a368c677b..2ef53697d877 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -1613,21 +1613,14 @@ int irq_domain_push_irq(struct irq_domain *domain, int virq, void *arg)
 	 * to deadlock, so we just do a simple check before starting.
 	 */
 	desc = irq_to_desc(virq);
-	if (!desc)
+	if (!desc || !domain || !irq_data)
 		return -EINVAL;
+
 	if (WARN_ON(desc->action))
 		return -EBUSY;
 
-	if (domain == NULL)
-		return -EINVAL;
-
-	if (WARN_ON(!irq_domain_is_hierarchy(domain)))
-		return -EINVAL;
-
-	if (!irq_data)
-		return -EINVAL;
-
-	if (domain->parent != irq_data->domain)
+	if (WARN_ON(!irq_domain_is_hierarchy(domain)) ||
+	    domain->parent != irq_data->domain)
 		return -EINVAL;
 
 	parent_irq_data = kzalloc_node(sizeof(*parent_irq_data), GFP_KERNEL,
@@ -1694,17 +1687,11 @@ int irq_domain_pop_irq(struct irq_domain *domain, int virq)
 	 * deadlock, so we just do a simple check before starting.
 	 */
 	desc = irq_to_desc(virq);
-	if (!desc)
+	if (!desc || !domain || !irq_data)
 		return -EINVAL;
 	if (WARN_ON(desc->action))
 		return -EBUSY;
 
-	if (domain == NULL)
-		return -EINVAL;
-
-	if (!irq_data)
-		return -EINVAL;
-
 	tmp_irq_data = irq_domain_get_irq_data(domain, virq);
 
 	/* We can only "pop" if this domain is at the top of the list */
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ