Patch "irqchip/riscv-aplic: Prevent crash when MSI domain is missing" has been added to the 6.12-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    irqchip/riscv-aplic: Prevent crash when MSI domain is missing

to the 6.12-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     irqchip-riscv-aplic-prevent-crash-when-msi-domain-is.patch
and it can be found in the queue-6.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 70baf55c612148e21ef34f9861dfc68a3bb11d98
Author: Samuel Holland <samuel.holland@xxxxxxxxxx>
Date:   Thu Nov 14 12:01:30 2024 -0800

    irqchip/riscv-aplic: Prevent crash when MSI domain is missing
    
    [ Upstream commit 1f181d1cda56c2fbe379c5ace1aa1fac6306669e ]
    
    If the APLIC driver is probed before the IMSIC driver, the parent MSI
    domain will be missing, which causes a NULL pointer dereference in
    msi_create_device_irq_domain().
    
    Avoid this by deferring probe until the parent MSI domain is available. Use
    dev_err_probe() to avoid printing an error message when returning
    -EPROBE_DEFER.
    
    Fixes: ca8df97fe679 ("irqchip/riscv-aplic: Add support for MSI-mode")
    Signed-off-by: Samuel Holland <samuel.holland@xxxxxxxxxx>
    Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
    Link: https://lore.kernel.org/all/20241114200133.3069460-1-samuel.holland@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/irqchip/irq-riscv-aplic-main.c b/drivers/irqchip/irq-riscv-aplic-main.c
index 900e72541db9e..93e7c51f944ab 100644
--- a/drivers/irqchip/irq-riscv-aplic-main.c
+++ b/drivers/irqchip/irq-riscv-aplic-main.c
@@ -207,7 +207,8 @@ static int aplic_probe(struct platform_device *pdev)
 	else
 		rc = aplic_direct_setup(dev, regs);
 	if (rc)
-		dev_err(dev, "failed to setup APLIC in %s mode\n", msi_mode ? "MSI" : "direct");
+		dev_err_probe(dev, rc, "failed to setup APLIC in %s mode\n",
+			      msi_mode ? "MSI" : "direct");
 
 #ifdef CONFIG_ACPI
 	if (!acpi_disabled)
diff --git a/drivers/irqchip/irq-riscv-aplic-msi.c b/drivers/irqchip/irq-riscv-aplic-msi.c
index 945bff28265cd..fb8d1838609fb 100644
--- a/drivers/irqchip/irq-riscv-aplic-msi.c
+++ b/drivers/irqchip/irq-riscv-aplic-msi.c
@@ -266,6 +266,9 @@ int aplic_msi_setup(struct device *dev, void __iomem *regs)
 			if (msi_domain)
 				dev_set_msi_domain(dev, msi_domain);
 		}
+
+		if (!dev_get_msi_domain(dev))
+			return -EPROBE_DEFER;
 	}
 
 	if (!msi_create_device_irq_domain(dev, MSI_DEFAULT_DOMAIN, &aplic_msi_template,




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux