mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 05:17:10 +09:00
PCI/MSI: Fix memory leak in free_msi_irqs()
commitb701c0b1feupstream. 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:1c51b50c29("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e015cef702
commit
f15e38fc0f
@@ -414,7 +414,7 @@ static void free_msi_irqs(struct pci_dev *dev)
|
||||
if (dev->msi_irq_groups) {
|
||||
sysfs_remove_groups(&dev->dev.kobj, dev->msi_irq_groups);
|
||||
msi_attrs = dev->msi_irq_groups[0]->attrs;
|
||||
list_for_each_entry(entry, &dev->msi_list, list) {
|
||||
while (msi_attrs[count]) {
|
||||
dev_attr = container_of(msi_attrs[count],
|
||||
struct device_attribute, attr);
|
||||
kfree(dev_attr->attr.name);
|
||||
|
||||
Reference in New Issue
Block a user