|
|
c687bc |
From c9b1eb9d6c0da9098d5410d90d290d6fca6ea7dc Mon Sep 17 00:00:00 2001
|
|
|
c687bc |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
c687bc |
Date: Wed, 16 Dec 2020 16:06:14 -0500
|
|
|
c687bc |
Subject: [PATCH 13/14] qga: fix missing closedir() in qmp_guest_get_disks()
|
|
|
c687bc |
MIME-Version: 1.0
|
|
|
c687bc |
Content-Type: text/plain; charset=UTF-8
|
|
|
c687bc |
Content-Transfer-Encoding: 8bit
|
|
|
c687bc |
|
|
|
c687bc |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
c687bc |
Message-id: <20201216160615.324213-10-marcandre.lureau@redhat.com>
|
|
|
c687bc |
Patchwork-id: 100481
|
|
|
c687bc |
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 09/10] qga: fix missing closedir() in qmp_guest_get_disks()
|
|
|
c687bc |
Bugzilla: 1859494
|
|
|
c687bc |
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
|
|
|
c687bc |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
c687bc |
|
|
|
c687bc |
From: Michael Roth <michael.roth@amd.com>
|
|
|
c687bc |
|
|
|
c687bc |
We opendir("/sys/block") at the beginning of the function, but we never
|
|
|
c687bc |
close it prior to returning.
|
|
|
c687bc |
|
|
|
c687bc |
Fixes: Coverity CID 1436130
|
|
|
c687bc |
Fixes: fed3956429d5 ("qga: add implementation of guest-get-disks for Linux")
|
|
|
c687bc |
Reported-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
c687bc |
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
c687bc |
Cc: Tomáš Golembiovský <tgolembi@redhat.com>
|
|
|
c687bc |
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
c687bc |
Signed-off-by: Michael Roth <michael.roth@amd.com>
|
|
|
c687bc |
|
|
|
c687bc |
(cherry-picked from commit b1b9ab1c04d560f86d8da3dfca4d8b21de75fee6)
|
|
|
c687bc |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
c687bc |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
c687bc |
---
|
|
|
c687bc |
qga/commands-posix.c | 3 +++
|
|
|
c687bc |
1 file changed, 3 insertions(+)
|
|
|
c687bc |
|
|
|
c687bc |
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
|
|
|
c687bc |
index 96f5ddafd3a..9a170dee14c 100644
|
|
|
c687bc |
--- a/qga/commands-posix.c
|
|
|
c687bc |
+++ b/qga/commands-posix.c
|
|
|
c687bc |
@@ -1445,6 +1445,9 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
|
|
c687bc |
get_disk_deps(disk_dir, disk);
|
|
|
c687bc |
ret = get_disk_partitions(ret, de->d_name, disk_dir, dev_name);
|
|
|
c687bc |
}
|
|
|
c687bc |
+
|
|
|
c687bc |
+ closedir(dp);
|
|
|
c687bc |
+
|
|
|
c687bc |
return ret;
|
|
|
c687bc |
}
|
|
|
c687bc |
|
|
|
c687bc |
--
|
|
|
c687bc |
2.27.0
|
|
|
c687bc |
|