|
|
ddf19c |
From ceb6d97674b8bc9a072db1be4167411bc0ee48d7 Mon Sep 17 00:00:00 2001
|
|
|
ddf19c |
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
|
|
|
ddf19c |
Date: Mon, 27 Jan 2020 19:02:02 +0100
|
|
|
ddf19c |
Subject: [PATCH 091/116] Virtiofsd: fix memory leak on fuse queueinfo
|
|
|
ddf19c |
MIME-Version: 1.0
|
|
|
ddf19c |
Content-Type: text/plain; charset=UTF-8
|
|
|
ddf19c |
Content-Transfer-Encoding: 8bit
|
|
|
ddf19c |
|
|
|
ddf19c |
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
Message-id: <20200127190227.40942-88-dgilbert@redhat.com>
|
|
|
ddf19c |
Patchwork-id: 93542
|
|
|
ddf19c |
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 087/112] Virtiofsd: fix memory leak on fuse queueinfo
|
|
|
ddf19c |
Bugzilla: 1694164
|
|
|
ddf19c |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
ddf19c |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
From: Liu Bo <bo.liu@linux.alibaba.com>
|
|
|
ddf19c |
|
|
|
ddf19c |
For fuse's queueinfo, both queueinfo array and queueinfos are allocated in
|
|
|
ddf19c |
fv_queue_set_started() but not cleaned up when the daemon process quits.
|
|
|
ddf19c |
|
|
|
ddf19c |
This fixes the leak in proper places.
|
|
|
ddf19c |
|
|
|
ddf19c |
Signed-off-by: Liu Bo <bo.liu@linux.alibaba.com>
|
|
|
ddf19c |
Signed-off-by: Eric Ren <renzhen@linux.alibaba.com>
|
|
|
ddf19c |
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
|
|
|
ddf19c |
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
|
|
|
ddf19c |
(cherry picked from commit 740b0b700a6338a1cf60c26229651ac5f6724944)
|
|
|
ddf19c |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
ddf19c |
---
|
|
|
ddf19c |
tools/virtiofsd/fuse_virtio.c | 8 ++++++++
|
|
|
ddf19c |
1 file changed, 8 insertions(+)
|
|
|
ddf19c |
|
|
|
ddf19c |
diff --git a/tools/virtiofsd/fuse_virtio.c b/tools/virtiofsd/fuse_virtio.c
|
|
|
ddf19c |
index b7948de..fb8d6d1 100644
|
|
|
ddf19c |
--- a/tools/virtiofsd/fuse_virtio.c
|
|
|
ddf19c |
+++ b/tools/virtiofsd/fuse_virtio.c
|
|
|
ddf19c |
@@ -625,6 +625,8 @@ static void fv_queue_cleanup_thread(struct fv_VuDev *vud, int qidx)
|
|
|
ddf19c |
}
|
|
|
ddf19c |
close(ourqi->kill_fd);
|
|
|
ddf19c |
ourqi->kick_fd = -1;
|
|
|
ddf19c |
+ free(vud->qi[qidx]);
|
|
|
ddf19c |
+ vud->qi[qidx] = NULL;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
|
|
|
ddf19c |
/* Callback from libvhost-user on start or stop of a queue */
|
|
|
ddf19c |
@@ -884,6 +886,12 @@ int virtio_session_mount(struct fuse_session *se)
|
|
|
ddf19c |
void virtio_session_close(struct fuse_session *se)
|
|
|
ddf19c |
{
|
|
|
ddf19c |
close(se->vu_socketfd);
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ if (!se->virtio_dev) {
|
|
|
ddf19c |
+ return;
|
|
|
ddf19c |
+ }
|
|
|
ddf19c |
+
|
|
|
ddf19c |
+ free(se->virtio_dev->qi);
|
|
|
ddf19c |
free(se->virtio_dev);
|
|
|
ddf19c |
se->virtio_dev = NULL;
|
|
|
ddf19c |
}
|
|
|
ddf19c |
--
|
|
|
ddf19c |
1.8.3.1
|
|
|
ddf19c |
|