[PATCH v3 2/5] mailbox: zynqmp-ipi: Fix SGI cleanup on request_percpu_irq() failure
Prasanna Kumar T S M
ptsm at linux.microsoft.com
Thu Dec 3 21:04:50 PST 2026
When xlnx_mbox_init_sgi() fails before or during request_percpu_irq(),
zynqmp_ipi_probe() still invokes xlnx_mbox_cleanup_sgi() through
zynqmp_ipi_free_mboxes(). This causes cleanup to run on an unmapped
virq_sgi or dispose the IRQ mapping a second time.
Clear virq_sgi after disposing the mapping on request_percpu_irq()
failure and teardown IRQ in xlnx_mbox_cleanup_sgi() only when virq_sgi
is valid.
Fixes: 6ffb1635341b ("mailbox: zynqmp: handle SGI for shared IPI")
Cc: stable at vger.kernel.org
Signed-off-by: Prasanna Kumar T S M <ptsm at linux.microsoft.com>
---
drivers/mailbox/zynqmp-ipi-mailbox.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/mailbox/zynqmp-ipi-mailbox.c b/drivers/mailbox/zynqmp-ipi-mailbox.c
index 179f361d04b3..b978f4e9f830 100644
--- a/drivers/mailbox/zynqmp-ipi-mailbox.c
+++ b/drivers/mailbox/zynqmp-ipi-mailbox.c
@@ -859,6 +859,7 @@ static int xlnx_mbox_init_sgi(struct platform_device *pdev,
WARN_ON(ret);
if (ret) {
irq_dispose_mapping(pdata->virq_sgi);
+ pdata->virq_sgi = 0;
return ret;
}
@@ -880,11 +881,13 @@ static void xlnx_mbox_cleanup_sgi(struct zynqmp_ipi_pdata *pdata)
if (pdata->hp_state >= CPUHP_AP_ONLINE_DYN)
cpuhp_remove_state(pdata->hp_state);
- on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
+ if (pdata->virq_sgi) {
+ on_each_cpu(xlnx_disable_percpu_irq, NULL, 1);
- irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU);
- free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata);
- irq_dispose_mapping(pdata->virq_sgi);
+ irq_clear_status_flags(pdata->virq_sgi, IRQ_PER_CPU);
+ free_percpu_irq(pdata->virq_sgi, &per_cpu_pdata);
+ irq_dispose_mapping(pdata->virq_sgi);
+ }
}
/**
--
2.49.0
More information about the linux-arm-kernel
mailing list