Skip to contentSkip to conversation

PCI/MSI: Fix msi_desc->affinity memory leak when freeing MSI IRQs.

PATCH New Prarit Bhargava 1 participant 1 message Feb 2, 2017 PCI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI/MSI: Fix msi_desc->affinity memory leak when freeing MSI IRQs.

During device setup, msix_setup_entries() and msi_setup_entry() allocate msi_desc by calling alloc_msi_entry(). alloc_msi_entry() can also allocate a affinity cpumask. During device teardown free_msi_irqs() is called and the msi_desc is freed, but the affinity cpumask is leaked.

Fix it by calling free_msi_entry() which frees both the msi_desc and the affinity cpumask.

---
 drivers/pci/msi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/msi.c +1 -1
index 50c5003295ca..3d709311052d 100644
@@ -379,7 +379,7 @@ static void free_msi_irqs(struct pci_dev *dev)
 		}
 
 		list_del(&entry->list);
-		kfree(entry);
+		free_msi_entry(entry);
 	}
 
 	if (dev->msi_irq_groups) {
Signature · 1 line
1.7.9.3