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,
Xianting Tian <xianting.tian@linux.alibaba.com>
Subject: [PATCH] vhost/test: fix memory leak of vhost virtqueues
Date: Tue, 28 Dec 2021 11:09:24 +0800 [thread overview]
Message-ID: <20211228030924.3468439-1-xianting.tian@linux.alibaba.com> (raw)
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
next reply other threads:[~2021-12-28 3:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-28 3:09 Xianting Tian [this message]
2022-01-04 5:58 ` Xianting Tian
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=20211228030924.3468439-1-xianting.tian@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®