mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xianting Tian <xianting.tian@linux.alibaba.com>
To: mst@redhat.com, jasowang@redhat.com
Cc: kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vhost/test: fix memory leak of vhost virtqueues
Date: Tue, 4 Jan 2022 13:58:47 +0800	[thread overview]
Message-ID: <8a7f84b6-8d63-0005-754b-cfd158c8952e@linux.alibaba.com> (raw)
In-Reply-To: <20211228030924.3468439-1-xianting.tian@linux.alibaba.com>

hi

Could I get your comments for this patch?  it fixed the memleak issue.

在 2021/12/28 上午11:09, Xianting Tian 写道:
> We need free the vqs in .release(), which are allocated in .open().
>
> Signed-off-by: Xianting Tian <xianting.tian@linux.alibaba.com>
> ---
>   drivers/vhost/test.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/vhost/test.c b/drivers/vhost/test.c
> index a09dedc79..05740cba1 100644
> --- a/drivers/vhost/test.c
> +++ b/drivers/vhost/test.c
> @@ -166,6 +166,7 @@ static int vhost_test_release(struct inode *inode, struct file *f)
>   	/* We do an extra flush before freeing memory,
>   	 * since jobs can re-queue themselves. */
>   	vhost_test_flush(n);
> +	kfree(n->dev.vqs);
>   	kfree(n);
>   	return 0;
>   }

  reply	other threads:[~2022-01-04  5:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-28  3:09 Xianting Tian
2022-01-04  5:58 ` Xianting Tian [this message]
2022-01-04  6:18   ` Jason Wang

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=8a7f84b6-8d63-0005-754b-cfd158c8952e@linux.alibaba.com \
    --to=xianting.tian@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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®