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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230324060854.29375-4-lvjianmin@loongson.cn>
Date:   Fri, 24 Mar 2023 14:08:52 +0800
From:   Jianmin Lv <lvjianmin@...ngson.cn>
To:     Thomas Gleixner <tglx@...utronix.de>, Marc Zyngier <maz@...nel.org>
Cc:     linux-kernel@...r.kernel.org, loongarch@...ts.linux.dev,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        Huacai Chen <chenhuacai@...ngson.cn>,
        loongson-kernel@...ts.loongnix.cn
Subject: [PATCH V1 3/5] irqchip/loongson-pch-pic: Fix pch_pic_acpi_init calling

For dual-bridges scenario, pch_pic_acpi_init() will be called in
following path:

cpuintc_acpi_init
  acpi_cascade_irqdomain_init(in cpuintc driver)
    acpi_table_parse_madt
      eiointc_parse_madt
        eiointc_acpi_init /* this will be called two times corresponding
                             to parsing two eiointc entrys in MADT under
                             dual-bridges scenario*/
          acpi_cascade_irqdomain_init(in pch_pic driver)
            acpi_table_parse_madt
              pch_pic_parse_madt
                pch_pic_acpi_init /* this will be called depend on valid parent IRQ
                                     domain handle for one or two times corresponding
                                     to parsing two pchpic entrys in MADT druring
                                     calling eiointc_acpi_init() under dual-bridges
                                     scenario*/

During the first eiointc_acpi_init() calling, the pch_pic_acpi_init()
will be called just one time since only one valid parent IRQ domain
handle will be found for current eiointc IRQ domain.

During the second eiointc_acpi_init() calling, the pch_pic_acpi_init()
will be called two times since two valid parent IRQ domain handles
will be found. So in pch_pic_acpi_init(), we must have a reasonable
way to prevent from creating second same pch_pic IRQ domain.

The patch matches gsi base information in created pch_pic IRQ domains
to check if the target domain has been created to avoid the bug
mentioned above.

Change-Id: Iacba57be83dcbfe7f61b94632d472bccfaaddc22
Signed-off-by: Jianmin Lv <lvjianmin@...ngson.cn>
---
 drivers/irqchip/irq-loongson-pch-pic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
index 437f1af693d0..e3c698ca11e9 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -403,6 +403,9 @@ int __init pch_pic_acpi_init(struct irq_domain *parent,
 	int ret, vec_base;
 	struct fwnode_handle *domain_handle;
 
+	if (find_pch_pic(acpi_pchpic->gsi_base) >= 0)
+		return 0;
+
 	vec_base = acpi_pchpic->gsi_base - GSI_MIN_PCH_IRQ;
 
 	domain_handle = irq_domain_alloc_fwnode(&acpi_pchpic->address);
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ