From: Auger Eric <eric.auger@redhat.com>
To: David Hildenbrand <david@redhat.com>, Li Qiang <liq3ea@gmail.com>,
alex.williamson@redhat.com
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
liqiang02@corp.netease.com
Subject: Re: [PATCH] vfio: fix potential memory leak in vfio_msi_cap_len
Date: Mon, 3 Sep 2018 19:00:17 +0200 [thread overview]
Message-ID: <ab8ffb59-03fb-c794-4cf7-76c72473eaeb@redhat.com> (raw)
In-Reply-To: <a6eb3c83-13c2-587a-557c-f1f072a0deff@redhat.com>
Hi Li, David,
On 08/30/2018 04:15 PM, David Hildenbrand wrote:
> On 27.08.2018 14:47, Li Qiang wrote:
>> Free the vdev->msi_perm in error path.
>>
>> Signed-off-by: Li Qiang <liq3ea@gmail.com>
>> ---
>> drivers/vfio/pci/vfio_pci_config.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c
>> index 115a36f6f403..62023b4a373b 100644
>> --- a/drivers/vfio/pci/vfio_pci_config.c
>> +++ b/drivers/vfio/pci/vfio_pci_config.c
>> @@ -1180,8 +1180,10 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
>> return -ENOMEM;
>>
>> ret = init_pci_cap_msi_perm(vdev->msi_perm, len, flags);
>> - if (ret)
>> + if (ret) {
>> + kfree(vdev->msi_perm);
>> return ret;
>> + }
>>
>> return len;
>> }
>>
>
> Doesn't vfio_config_free() take care of that in all cases?
Looks OK to me.
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Looks vfio_config_free is called on vfio_pci_release whereas
vfio_msi_cap_len can fail in vfio_pci_open path.
Thanks
Eric
>
next prev parent reply other threads:[~2018-09-03 17:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-27 12:47 Li Qiang
2018-08-30 14:15 ` David Hildenbrand
2018-09-03 17:00 ` Auger Eric [this message]
2018-09-04 15:52 ` Alex Williamson
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=ab8ffb59-03fb-c794-4cf7-76c72473eaeb@redhat.com \
--to=eric.auger@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=david@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liq3ea@gmail.com \
--cc=liqiang02@corp.netease.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome