mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Kunwu Chan <chentao@kylinos.cn>
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: Fri, 12 Jan 2024 08:34:47 -0700	[thread overview]
Message-ID: <20240112083447.750ad1c6.alex.williamson@redhat.com> (raw)
In-Reply-To: <20240112064107.137384-1-chentao@kylinos.cn>

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


  reply	other threads:[~2024-01-12 15:34 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 [this message]
2024-01-15  6:08   ` Kunwu Chan

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=20240112083447.750ad1c6.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=a.motakis@virtualopensystems.com \
    --cc=b.reynal@virtualopensystems.com \
    --cc=chentao@kylinos.cn \
    --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®