aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@plumgrid.com>2014-06-04 18:49:50 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-06-11 13:13:19 -0400
commitb701c0b1fe819a2083fc6ec5332e0e4492b9516d (patch)
tree1c42a0508a55e736faa6a7e04731a674caa02099
parent843a85ced99b9c8f8221f11d5cbcc56c2dae2842 (diff)
PCI/MSI: Fix memory leak in free_msi_irqs()
free_msi_irqs() is leaking memory, since list_for_each_entry(entry, &dev->msi_list, list) {...} is never executed, because dev->msi_list is made empty by the loop just above this one. Fix it by relying on zero termination of attribute array like populate_msi_sysfs() does. Fixes: 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects") Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> CC: stable@vger.kernel.org # v3.14+
-rw-r--r--drivers/pci/msi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index 27a7e67ddfe4..229b0d13f08d 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -413,7 +413,7 @@ static void free_msi_irqs(struct pci_dev *dev)
413 if (dev->msi_irq_groups) { 413 if (dev->msi_irq_groups) {
414 sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups); 414 sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
415 msi_attrs = dev->msi_irq_groups[0]->attrs; 415 msi_attrs = dev->msi_irq_groups[0]->attrs;
416 list_for_each_entry(entry, &dev->msi_list, list) { 416 while (msi_attrs[count]) {
417 dev_attr = container_of(msi_attrs[count], 417 dev_attr = container_of(msi_attrs[count],
418 struct device_attribute, attr); 418 struct device_attribute, attr);
419 kfree(dev_attr->attr.name); 419 kfree(dev_attr->attr.name);