All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Alexei Starovoitov <ast@plumgrid.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Neil Horman <nhorman@tuxdriver.com>
Subject: [PATCH 3.15 04/12] PCI/MSI: Fix memory leak in free_msi_irqs()
Date: Thu, 12 Jun 2014 16:21:06 -0700	[thread overview]
Message-ID: <20140612232045.075678429@linuxfoundation.org> (raw)
In-Reply-To: <20140612232044.886466924@linuxfoundation.org>

3.15-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Alexei Starovoitov <ast@plumgrid.com>

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 <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>

---
 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);



  parent reply	other threads:[~2014-06-12 23:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12 23:21 [PATCH 3.15 00/12] 3.15.1-stable review Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 01/12] fs,userns: Change inode_capable to capable_wrt_inode_uidgid Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 02/12] lock_parent: dont step on stale ->d_parent of all-but-freed one Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 03/12] auditsc: audit_krule mask accesses need bounds checking Greg Kroah-Hartman
2014-06-12 23:21 ` Greg Kroah-Hartman [this message]
2014-06-12 23:21 ` [PATCH 3.15 05/12] mei: me: fix hw ready reset flow Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 06/12] mei: me: drop harmful wait optimization Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 07/12] mei: me: read H_CSR after asserting reset Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 08/12] [media] rtl28xxu: add 1b80:d395 Peak DVB-T USB Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 09/12] [media] rtl28xxu: add [1b80:d39d] Sveon STV20 Greg Kroah-Hartman
2014-06-12 23:21 ` [PATCH 3.15 10/12] [media] rtl28xxu: add [1b80:d3af] Sveon STV27 Greg Kroah-Hartman
2014-06-13 15:16 ` [PATCH 3.15 00/12] 3.15.1-stable review Guenter Roeck
2014-06-13 16:07   ` Greg Kroah-Hartman
2014-06-13 16:18     ` Guenter Roeck
2014-06-14 10:31   ` Satoru Takeuchi
2014-06-14 14:41     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140612232045.075678429@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=ast@plumgrid.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.