From: Kunwu Chan <chentao@kylinos.cn>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: eric.auger@redhat.com, a.motakis@virtualopensystems.com,
b.reynal@virtualopensystems.com, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfio/platform: Remove unnecessary free in vfio_set_trigger
Date: Mon, 15 Jan 2024 14:08:39 +0800 [thread overview]
Message-ID: <0063df77-aede-4365-819e-5ec8eb6c5b3f@kylinos.cn> (raw)
In-Reply-To: <20240112083447.750ad1c6.alex.williamson@redhat.com>
On 2024/1/12 23:34, Alex Williamson wrote:
> On Fri, 12 Jan 2024 14:41:07 +0800
> Kunwu Chan <chentao@kylinos.cn> wrote:
>
>> commit 57f972e2b341 ("vfio/platform: trigger an interrupt via eventfd")
>> add 'name' as member for vfio_platform_irq,it's initialed by kasprintf,
>> so there is no need to free it before initializing.
>
> What?! Just look at the call path where vfio_set_trigger() is called
> with a valid fd and existing trigger. This change would leak irq->name
> as it's reallocated via kasprintf(). Thanks,
>
> Alex
>
>> Fixes: 57f972e2b341 ("vfio/platform: trigger an interrupt via eventfd")
>> Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
>> ---
>> drivers/vfio/platform/vfio_platform_irq.c | 1 -
>> 1 file changed, 1 deletion(-)
>>
>> diff --git a/drivers/vfio/platform/vfio_platform_irq.c b/drivers/vfio/platform/vfio_platform_irq.c
>> index 61a1bfb68ac7..5e3fd1926366 100644
>> --- a/drivers/vfio/platform/vfio_platform_irq.c
>> +++ b/drivers/vfio/platform/vfio_platform_irq.c
>> @@ -179,7 +179,6 @@ static int vfio_set_trigger(struct vfio_platform_device *vdev, int index,
>> if (irq->trigger) {
>> irq_clear_status_flags(irq->hwirq, IRQ_NOAUTOEN);
>> free_irq(irq->hwirq, irq);
>> - kfree(irq->name);
>> eventfd_ctx_put(irq->trigger);
>> irq->trigger = NULL;
>> }
>
Thanks for your reply.
It's my bad.I misunderstood. Sorry to bother you.
--
Thanks,
Kunwu
prev parent reply other threads:[~2024-01-15 6:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-12 6:41 Kunwu Chan
2024-01-12 15:34 ` Alex Williamson
2024-01-15 6:08 ` Kunwu Chan [this message]
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=0063df77-aede-4365-819e-5ec8eb6c5b3f@kylinos.cn \
--to=chentao@kylinos.cn \
--cc=a.motakis@virtualopensystems.com \
--cc=alex.williamson@redhat.com \
--cc=b.reynal@virtualopensystems.com \
--cc=eric.auger@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®