[PATCH 1/8] PCI: dwc: Export the multiplexed MSI interrupt handler
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Nov 23 10:52:30 PST 2026
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] PCI: dwc: use-after-free in dw_pcie_free_msi() [1]
--
commit 73ef750c2f801a3eaf7bfcf95e0a5bd88aebd4c3
Author: Fil Dunsky <filipp.dunsky at gmail.com>
PCI: dwc: Export the multiplexed MSI interrupt handler
This commit exports dw_handle_msi_irq() so that modular DesignWare PCIe host
glue drivers can dispatch the internal MSI receiver directly from a combined
application interrupt handler.
> diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
> index bbb02458af58f..1d076bb62783c 100644
> --- a/drivers/pci/controller/dwc/pcie-designware-host.c
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -85,6 +85,7 @@ void dw_handle_msi_irq(struct dw_pcie_rp *pp)
> generic_handle_demux_domain_irq(pp->msi_irq_domain, irq_off + pos);
> }
> }
> +EXPORT_SYMBOL_GPL(dw_handle_msi_irq);
>
> /* Chained MSI interrupt service routine */
> static void dw_chained_msi_isr(struct irq_desc *desc)
[Severity: Critical]
This problem wasn't introduced by this patch, but can dw_handle_msi_irq() hit
a use-after-free on pp->msi_irq_domain when racing with dw_pcie_free_msi()
[1]?
During device unbind or module removal, dw_pcie_free_msi() clears the chained
MSI handlers with irq_set_chained_handler_and_data() and immediately removes
pp->msi_irq_domain without waiting for in-flight interrupts on other CPUs:
drivers/pci/controller/dwc/pcie-designware-host.c:dw_pcie_free_msi() {
for (ctrl = 0; ctrl < MAX_MSI_CTRLS; ctrl++) {
if (pp->msi_irq[ctrl] > 0)
irq_set_chained_handler_and_data(pp->msi_irq[ctrl],
NULL, NULL);
}
irq_domain_remove(pp->msi_irq_domain);
}
If dw_chained_msi_isr() is already running on another CPU when teardown
starts, dw_handle_msi_irq() will pass the freed pp->msi_irq_domain to
generic_handle_demux_domain_irq():
CPU0 CPU1
dw_pcie_free_msi() dw_chained_msi_isr()
irq_set_chained_handler_and_data()
irq_domain_remove(pp->msi_irq_domain)
dw_handle_msi_irq(pp)
generic_handle_demux_domain_irq(
pp->msi_irq_domain, ...)
<-- use-after-free
Calling synchronize_irq() for each active pp->msi_irq[ctrl] before
irq_domain_remove() would ensure no chained handler is still running.
[1] https://sashiko.dev/#/bug/linux-a392f803-d749-417f-bb89-17e283cf6476
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-b4-cs7542-pcie-v1-0-4cde5201d404@gmail.com?part=1
More information about the linux-phy
mailing list