Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: hv: Fix potential MMIO leak on bridge window allocation failure
@ 2026-12-06  1:42 Tian Xuechen
  2026-12-06  1:56 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Tian Xuechen @ 2026-12-06  1:42 UTC (permalink / raw)
  To: haiyangz
  Cc: wei.liu, decui, lpieralisi, kwilczynski, mani, robh, bhelgaas,
	jakeo, linux-hyperv, linux-pci, linux-kernel

From: Tian Xuechen <202300460064@mail.sdu.edu.cn>

The low MMIO resource has IORESOURCE_BUSY cleared when it becomes a
bridge window. If high MMIO allocation then fails, vmbus_free_mmio()
cannot release that resource because release_mem_region() requires
the busy flag.

Restore the flag before rollback, as the normal teardown does.

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

Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
 drivers/pci/controller/pci-hyperv.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 89816a2..5344e4a 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -3390,6 +3390,7 @@ static int hv_pci_allocate_bridge_windows(struct hv_pcibus_device *hbus)
 
 release_low_mmio:
 	if (hbus->low_mmio_res) {
+		hbus->low_mmio_res->flags |= IORESOURCE_BUSY;
 		vmbus_free_mmio(hbus->low_mmio_res->start,
 				resource_size(hbus->low_mmio_res));
 	}

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
-- 
2.53.0


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

* Re: [PATCH] PCI: hv: Fix potential MMIO leak on bridge window allocation failure
  2026-12-06  1:42 [PATCH] PCI: hv: Fix potential MMIO leak on bridge window allocation failure Tian Xuechen
@ 2026-12-06  1:56 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-06  1:56 UTC (permalink / raw)
  To: Tian Xuechen; +Cc: linux-pci

> From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> 
> The low MMIO resource has IORESOURCE_BUSY cleared when it becomes a
> bridge window. If high MMIO allocation then fails, vmbus_free_mmio()
> cannot release that resource because release_mem_region() requires
> the busy flag.
> 
> Restore the flag before rollback, as the normal teardown does.
> 
> This issue was found by our static analysis tool under development.
> 
> Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206014239.3413261-1-202300460064@mail.sdu.edu.cn?part=1

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-06  1:42 [PATCH] PCI: hv: Fix potential MMIO leak on bridge window allocation failure Tian Xuechen
2026-12-06  1:56 ` sashiko-bot

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