public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI/MSI: Fix memory leak in pci_alloc_irq_vectors_affinity INTx path
@ 2026-04-20  4:09 neilfsun
  2026-04-20  4:47 ` Hans Zhang
  0 siblings, 1 reply; 5+ messages in thread
From: neilfsun @ 2026-04-20  4:09 UTC (permalink / raw)
  To: bhelgaas, shawn.lin, hans.zhang, tglx, linux-pci, linux-kernel
  Cc: neilfsun, Sun Feng

In the INTx fallback path of pci_alloc_irq_vectors_affinity(),
affinity masks are created and never freed.

Signed-off-by: neilfsun <neilfsun@tencent.com>
Signed-off-by: Sun Feng <loyou85@gmail.com>
---
 drivers/pci/msi/api.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/msi/api.c b/drivers/pci/msi/api.c
index c18559b6272c..c1377f74b8f3 100644
--- a/drivers/pci/msi/api.c
+++ b/drivers/pci/msi/api.c
@@ -280,14 +280,17 @@ int pci_alloc_irq_vectors_affinity(struct pci_dev *dev, unsigned int min_vecs,
 	/* use INTx IRQ if allowed */
 	if (flags & PCI_IRQ_INTX) {
 		if (min_vecs == 1 && dev->irq) {
+			struct irq_affinity_desc *masks = NULL;
+
 			/*
 			 * Invoke the affinity spreading logic to ensure that
 			 * the device driver can adjust queue configuration
 			 * for the single interrupt case.
 			 */
 			if (affd)
-				irq_create_affinity_masks(1, affd);
+				masks = irq_create_affinity_masks(1, affd);
 			pci_intx(dev, 1);
+			kfree(masks);
 			return 1;
 		}
 	}
-- 
2.52.0


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

end of thread, other threads:[~2026-04-21  8:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20  4:09 [PATCH] PCI/MSI: Fix memory leak in pci_alloc_irq_vectors_affinity INTx path neilfsun
2026-04-20  4:47 ` Hans Zhang
2026-04-21  3:20   ` [PATCH v2 v2] " neilfsun
2026-04-21  6:24     ` Shawn Lin
2026-04-21  8:06     ` Thomas Gleixner

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