This is a note to let you know that I've just added the patch titled

    PCI/MSI: Fix memory leak in free_msi_irqs()

to the 3.14-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-msi-fix-memory-leak-in-free_msi_irqs.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From b701c0b1fe819a2083fc6ec5332e0e4492b9516d Mon Sep 17 00:00:00 2001
From: Alexei Starovoitov <[email protected]>
Date: Wed, 4 Jun 2014 15:49:50 -0700
Subject: PCI/MSI: Fix memory leak in free_msi_irqs()

From: Alexei Starovoitov <[email protected]>

commit b701c0b1fe819a2083fc6ec5332e0e4492b9516d upstream.

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 <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Acked-by: Neil Horman <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/pci/msi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -414,7 +414,7 @@ static void free_msi_irqs(struct pci_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);


Patches currently in stable-queue which might be from [email protected] are

queue-3.14/pci-msi-fix-memory-leak-in-free_msi_irqs.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to