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

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