PCI/MSI: Fix memory leak in free_msi_irqs() (regression in 3.14)

svn path=/dists/sid/linux/; revision=21442
This commit is contained in:
Ben Hutchings 2014-06-15 23:14:38 +00:00
parent 7ed1428a75
commit 58b54a1127
3 changed files with 35 additions and 0 deletions

1
debian/changelog vendored
View File

@ -229,6 +229,7 @@ linux (3.14.7-1) UNRELEASED; urgency=medium
* fs,userns: Change inode_capable to capable_wrt_inode_uidgid
(CVE-2014-4014)
* SCSI: Fix spurious request sense in error handling (regression in 3.14)
* PCI/MSI: Fix memory leak in free_msi_irqs() (regression in 3.14)
-- Ian Campbell <ijc@hellion.org.uk> Fri, 06 Jun 2014 18:18:41 +0100

View File

@ -0,0 +1,33 @@
From: Alexei Starovoitov <ast@plumgrid.com>
Date: Wed, 4 Jun 2014 15:49:50 -0700
Subject: PCI/MSI: Fix memory leak in free_msi_irqs()
Origin: https://git.kernel.org/linus/b701c0b1fe819a2083fc6ec5332e0e4492b9516d
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+
---
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);

View File

@ -96,3 +96,4 @@ debian/dma-avoid-abi-change-in-3.14.6.patch
bugfix/all/fs-userns-change-inode_capable-to-capable_wrt_inode_uidgid.patch
debian/vfs-avoid-abi-change-for-cve-2014-4014.patch
bugfix/all/SCSI-Fix-spurious-request-sense-in-error-handling.patch
bugfix/all/PCI-MSI-Fix-memory-leak-in-free_msi_irqs.patch