* [PATCH] vhost/test: fix memory leak of vhost virtqueues
@ 2021-12-28 3:09 Xianting Tian
2022-01-04 5:58 ` Xianting Tian
0 siblings, 1 reply; 3+ messages in thread
From: Xianting Tian @ 2021-12-28 3:09 UTC (permalink / raw)
To: mst, jasowang; +Cc: kvm, virtualization, netdev, linux-kernel, 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;
}
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost/test: fix memory leak of vhost virtqueues
2021-12-28 3:09 [PATCH] vhost/test: fix memory leak of vhost virtqueues Xianting Tian
@ 2022-01-04 5:58 ` Xianting Tian
2022-01-04 6:18 ` Jason Wang
0 siblings, 1 reply; 3+ messages in thread
From: Xianting Tian @ 2022-01-04 5:58 UTC (permalink / raw)
To: mst, jasowang; +Cc: kvm, virtualization, netdev, linux-kernel
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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] vhost/test: fix memory leak of vhost virtqueues
2022-01-04 5:58 ` Xianting Tian
@ 2022-01-04 6:18 ` Jason Wang
0 siblings, 0 replies; 3+ messages in thread
From: Jason Wang @ 2022-01-04 6:18 UTC (permalink / raw)
To: Xianting Tian; +Cc: mst, kvm, virtualization, netdev, linux-kernel
On Tue, Jan 4, 2022 at 1:59 PM Xianting Tian
<xianting.tian@linux.alibaba.com> wrote:
>
> 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>
Acked-by: Jason Wang <jasowang@redhat.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;
> > }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-04 6:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 3:09 [PATCH] vhost/test: fix memory leak of vhost virtqueues Xianting Tian
2022-01-04 5:58 ` Xianting Tian
2022-01-04 6:18 ` Jason Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).