From: Prarit Bhargava <prarit@redhat.com>
To: Linux PCI <linux-pci@vger.kernel.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>, Myron Stowe <mstowe@redhat.com>
Subject: Re: [RESENT PATCH] PCI/MSI: Fix msi_desc->affinity memory leak when freeing MSI IRQs.
Date: Thu, 16 Feb 2017 07:47:15 -0500 [thread overview]
Message-ID: <58A59F53.60005@redhat.com> (raw)
In-Reply-To: <20170215235657.GC26758@bhelgaas-glaptop.roam.corp.google.com>
On 02/15/2017 06:56 PM, Bjorn Helgaas wrote:
> On Wed, Feb 15, 2017 at 11:53:08AM -0500, Prarit Bhargava wrote:
>> No response ... trying again.
>>
>> P.
>>
>> ---8<---
>>
>> During device setup, msix_setup_entries() and msi_setup_entry() allocate
>> msi_desc by calling alloc_msi_entry(). alloc_msi_entry() can also allocate a
>> affinity cpumask. During device teardown free_msi_irqs() is called and the
>> msi_desc is freed, but the affinity cpumask is leaked.
>>
>> Fix it by calling free_msi_entry() which frees both the msi_desc and the
>> affinity cpumask.
>
> Sorry for the delay, Prarit. I started looking at this when you first
> posted it. The more I looked at it, the less I liked the setup/free
> paths -- they're not very parallel and I don't remember what else.
>
Yes, I noticed this as well. As you say ...
> But I guess it's probably a longer term effort to clean that up.
>
... there's a larger cleanup that's required here.
> Do you have a bug report or anything for this, or did you just find
> this by code inspection? If there's a bugzilla or even a symptom, we
> could mention it in the changelog.
>
This was noticed during code inspection while Myron & I were debugging
an issue in RHEL7.
P.
>> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
>> Cc: mstowe@redhat.com
>> Cc: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>> drivers/pci/msi.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
>> index 50c5003295ca..3d709311052d 100644
>> --- a/drivers/pci/msi.c
>> +++ b/drivers/pci/msi.c
>> @@ -379,7 +379,7 @@ static void free_msi_irqs(struct pci_dev *dev)
>> }
>>
>> list_del(&entry->list);
>> - kfree(entry);
>> + free_msi_entry(entry);
>> }
>>
>> if (dev->msi_irq_groups) {
>> --
>> 1.7.9.3
>>
next prev parent reply other threads:[~2017-02-16 12:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 16:53 [RESENT PATCH] PCI/MSI: Fix msi_desc->affinity memory leak when freeing MSI IRQs Prarit Bhargava
2017-02-15 23:56 ` Bjorn Helgaas
2017-02-16 12:47 ` Prarit Bhargava [this message]
2017-02-17 21:47 ` Bjorn Helgaas
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=58A59F53.60005@redhat.com \
--to=prarit@redhat.com \
--cc=helgaas@kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mstowe@redhat.com \
/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.