* [PATCH] x86/PCI: Fix device reference leak in pirq_find_router()
@ 2026-09-15 7:03 Wentao Liang
2026-09-15 7:08 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-15 7:03 UTC (permalink / raw)
To: bhelgaas
Cc: bp, dave.hansen, hpa, linux-kernel, linux-pci, macro, mingo, tglx,
x86, Wentao Liang, stable
pci_get_domain_bus_and_slot() takes a reference on the router device
looked up from the routing table. If the device is found but no router
handler probes it successfully, the reference is neither stored in
pirq_router_dev nor dropped. Put the device reference when the router
probe fails.
Fixes: ac7cd5e16df8 ("x86/PCI: Handle PIRQ routing tables with no router device given")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
arch/x86/pci/irq.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 0de436316a1d..2bb80b6bf606 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -1312,8 +1312,12 @@ static void __init pirq_find_router(struct irq_router *r)
if (rt->rtr_vendor) {
dev = pci_get_domain_bus_and_slot(0, rt->rtr_bus,
rt->rtr_devfn);
- if (dev && pirq_try_router(r, rt, dev))
- pirq_router_dev = dev;
+ if (dev) {
+ if (pirq_try_router(r, rt, dev))
+ pirq_router_dev = dev;
+ else
+ pci_dev_put(dev);
+ }
} else {
dev = NULL;
for_each_pci_dev(dev) {
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/PCI: Fix device reference leak in pirq_find_router()
2026-09-15 7:03 [PATCH] x86/PCI: Fix device reference leak in pirq_find_router() Wentao Liang
@ 2026-09-15 7:08 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-09-15 7:08 UTC (permalink / raw)
To: Wentao Liang; +Cc: linux-pci
> pci_get_domain_bus_and_slot() takes a reference on the router device
> looked up from the routing table. If the device is found but no router
> handler probes it successfully, the reference is neither stored in
> pirq_router_dev nor dropped. Put the device reference when the router
> probe fails.
>
> Fixes: ac7cd5e16df8 ("x86/PCI: Handle PIRQ routing tables with no router device given")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260915070310.1733310-1-vulab@iscas.ac.cn?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-15 7:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15 7:03 [PATCH] x86/PCI: Fix device reference leak in pirq_find_router() Wentao Liang
2026-09-15 7:08 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox