|
|
709dde |
From 12e5342e10c384539c8c26f075ce98ebbe887a05 Mon Sep 17 00:00:00 2001
|
|
|
709dde |
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
|
|
|
709dde |
Date: Fri, 8 Jan 2021 07:41:00 -0500
|
|
|
709dde |
Subject: [PATCH 09/10] qga: fix missing closedir() in qmp_guest_get_disks()
|
|
|
709dde |
MIME-Version: 1.0
|
|
|
709dde |
Content-Type: text/plain; charset=UTF-8
|
|
|
709dde |
Content-Transfer-Encoding: 8bit
|
|
|
709dde |
|
|
|
709dde |
RH-Author: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
Message-id: <20210108074101.290008-10-marcandre.lureau@redhat.com>
|
|
|
709dde |
Patchwork-id: 100528
|
|
|
709dde |
O-Subject: [RHEL-8.3.0.z qemu-kvm PATCH 09/10] qga: fix missing closedir() in qmp_guest_get_disks()
|
|
|
709dde |
Bugzilla: 1913818
|
|
|
709dde |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
709dde |
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
709dde |
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
|
|
|
709dde |
|
|
|
709dde |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
|
|
|
709dde |
From: Michael Roth <michael.roth@amd.com>
|
|
|
709dde |
|
|
|
709dde |
We opendir("/sys/block") at the beginning of the function, but we never
|
|
|
709dde |
close it prior to returning.
|
|
|
709dde |
|
|
|
709dde |
Fixes: Coverity CID 1436130
|
|
|
709dde |
Fixes: fed3956429d5 ("qga: add implementation of guest-get-disks for Linux")
|
|
|
709dde |
Reported-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
709dde |
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
Cc: Tomáš Golembiovský <tgolembi@redhat.com>
|
|
|
709dde |
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
|
|
|
709dde |
Signed-off-by: Michael Roth <michael.roth@amd.com>
|
|
|
709dde |
|
|
|
709dde |
(cherry-picked from commit b1b9ab1c04d560f86d8da3dfca4d8b21de75fee6)
|
|
|
709dde |
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
709dde |
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
|
|
|
709dde |
---
|
|
|
709dde |
qga/commands-posix.c | 3 +++
|
|
|
709dde |
1 file changed, 3 insertions(+)
|
|
|
709dde |
|
|
|
709dde |
diff --git a/qga/commands-posix.c b/qga/commands-posix.c
|
|
|
709dde |
index af80bb7ccbb..1a9c2cbc3e6 100644
|
|
|
709dde |
--- a/qga/commands-posix.c
|
|
|
709dde |
+++ b/qga/commands-posix.c
|
|
|
709dde |
@@ -1384,6 +1384,9 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
|
|
|
709dde |
get_disk_deps(disk_dir, disk);
|
|
|
709dde |
ret = get_disk_partitions(ret, de->d_name, disk_dir, dev_name);
|
|
|
709dde |
}
|
|
|
709dde |
+
|
|
|
709dde |
+ closedir(dp);
|
|
|
709dde |
+
|
|
|
709dde |
return ret;
|
|
|
709dde |
}
|
|
|
709dde |
|
|
|
709dde |
--
|
|
|
709dde |
2.27.0
|
|
|
709dde |
|