Blame SOURCES/kvm-qga-fix-missing-closedir-in-qmp_guest_get_disks.patch

a19a21
From c9b1eb9d6c0da9098d5410d90d290d6fca6ea7dc Mon Sep 17 00:00:00 2001
709dde
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
a19a21
Date: Wed, 16 Dec 2020 16:06:14 -0500
a19a21
Subject: [PATCH 13/14] 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>
a19a21
Message-id: <20201216160615.324213-10-marcandre.lureau@redhat.com>
a19a21
Patchwork-id: 100481
a19a21
O-Subject: [RHEL-8.4.0 qemu-kvm PATCH v2 09/10] qga: fix missing closedir() in qmp_guest_get_disks()
a19a21
Bugzilla: 1859494
a19a21
RH-Acked-by: Danilo de Paula <ddepaula@redhat.com>
a19a21
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
a19a21
RH-Acked-by: Stefan Hajnoczi <stefanha@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
a19a21
index 96f5ddafd3a..9a170dee14c 100644
709dde
--- a/qga/commands-posix.c
709dde
+++ b/qga/commands-posix.c
a19a21
@@ -1445,6 +1445,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