Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: rockchip-dw: Fix potential stale INTx handler on probe failure
@ 2026-12-01 12:29 Guangshuo Li
  2026-12-01 12:34 ` sashiko-bot
  2026-12-01 13:05 ` Shawn Lin
  0 siblings, 2 replies; 3+ messages in thread
From: Guangshuo Li @ 2026-12-01 12:29 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, bhelgaas, heiko
  Cc: robh, maz, pgwipeout, linux-pci, linux-arm-kernel, linux-rockchip

If host initialization fails, probe cleanup releases the Rockchip
controller but leaves the chained INTx handler and its domain
registered. Both retain pointers to the freed controller.

Clear the chained handler and remove the unused domain before returning
the host initialization error.

This issue was found by our static analysis tool under development.

Fixes: e8aae154df61 ("PCI: rockchip-dwc: Add legacy interrupt support")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
index ab2e26699409..138f69d0a18c 100644
--- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
+++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
@@ -736,6 +736,8 @@ static int rockchip_pcie_configure_rc(struct platform_device *pdev,
 	ret = dw_pcie_host_init(pp);
 	if (ret) {
 		dev_err(dev, "failed to initialize host\n");
+		irq_set_chained_handler_and_data(irq, NULL, NULL);
+		irq_domain_remove(rockchip->irq_domain);
 		return ret;
 	}
 

base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: rockchip-dw: Fix potential stale INTx handler on probe failure
  2026-12-01 12:29 [PATCH] PCI: rockchip-dw: Fix potential stale INTx handler on probe failure Guangshuo Li
@ 2026-12-01 12:34 ` sashiko-bot
  2026-12-01 13:05 ` Shawn Lin
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-01 12:34 UTC (permalink / raw)
  To: Guangshuo Li; +Cc: linux-pci

> If host initialization fails, probe cleanup releases the Rockchip
> controller but leaves the chained INTx handler and its domain
> registered. Both retain pointers to the freed controller.
> 
> Clear the chained handler and remove the unused domain before returning
> the host initialization error.
> 
> This issue was found by our static analysis tool under development.
> 
> Fixes: e8aae154df61 ("PCI: rockchip-dwc: Add legacy interrupt support")
> Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-52610d65e6-pci-rockchip@mail.sdu.edu.cn?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: rockchip-dw: Fix potential stale INTx handler on probe failure
  2026-12-01 12:29 [PATCH] PCI: rockchip-dw: Fix potential stale INTx handler on probe failure Guangshuo Li
  2026-12-01 12:34 ` sashiko-bot
@ 2026-12-01 13:05 ` Shawn Lin
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn Lin @ 2026-12-01 13:05 UTC (permalink / raw)
  To: Guangshuo Li, lpieralisi, kwilczynski, mani, bhelgaas, heiko
  Cc: shawn.lin, robh, maz, pgwipeout, linux-pci, linux-arm-kernel,
	linux-rockchip

在 2026/12/01 星期二 20:29, Guangshuo Li 写道:
> If host initialization fails, probe cleanup releases the Rockchip
> controller but leaves the chained INTx handler and its domain
> registered. Both retain pointers to the freed controller.
> 
> Clear the chained handler and remove the unused domain before returning
> the host initialization error.
> 

Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>

> This issue was found by our static analysis tool under development.
> 
> Fixes: e8aae154df61 ("PCI: rockchip-dwc: Add legacy interrupt support")
> Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
> ---
>   drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> index ab2e26699409..138f69d0a18c 100644
> --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c
> @@ -736,6 +736,8 @@ static int rockchip_pcie_configure_rc(struct platform_device *pdev,
>   	ret = dw_pcie_host_init(pp);
>   	if (ret) {
>   		dev_err(dev, "failed to initialize host\n");
> +		irq_set_chained_handler_and_data(irq, NULL, NULL);
> +		irq_domain_remove(rockchip->irq_domain);
>   		return ret;
>   	}
>   
> 
> base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
> 
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-01 13:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 12:29 [PATCH] PCI: rockchip-dw: Fix potential stale INTx handler on probe failure Guangshuo Li
2026-12-01 12:34 ` sashiko-bot
2026-12-01 13:05 ` Shawn Lin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox