qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-5.2] qga: fix missing closedir() in qmp_guest_get_disks()
@ 2020-11-08 16:11 Michael Roth
  2020-11-08 17:09 ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Roth @ 2020-11-08 16:11 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Tomáš Golembiovský,
	Marc-André Lureau

We opendir("/sys/block") at the beginning of the function, but we never
close it prior to returning.

Fixes: Coverity CID 1436130
Fixes: fed3956429d5 ("qga: add implementation of guest-get-disks for Linux")
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Tomáš Golembiovský <tgolembi@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 qga/commands-posix.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 3711080d07..12c1ba5ef7 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -1443,6 +1443,9 @@ GuestDiskInfoList *qmp_guest_get_disks(Error **errp)
         get_disk_deps(disk_dir, disk);
         ret = get_disk_partitions(ret, de->d_name, disk_dir, dev_name);
     }
+
+    closedir(dp);
+
     return ret;
 }
 
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH for-5.2] qga: fix missing closedir() in qmp_guest_get_disks()
  2020-11-08 16:11 [PATCH for-5.2] qga: fix missing closedir() in qmp_guest_get_disks() Michael Roth
@ 2020-11-08 17:09 ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-08 17:09 UTC (permalink / raw)
  To: Michael Roth, qemu-devel
  Cc: Peter Maydell, Tomáš Golembiovský,
	Marc-André Lureau

On 11/8/20 5:11 PM, Michael Roth wrote:
> We opendir("/sys/block") at the beginning of the function, but we never
> close it prior to returning.
> 
> Fixes: Coverity CID 1436130
> Fixes: fed3956429d5 ("qga: add implementation of guest-get-disks for Linux")
> Reported-by: Peter Maydell <peter.maydell@linaro.org>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: Tomáš Golembiovský <tgolembi@redhat.com>
> Signed-off-by: Michael Roth <michael.roth@amd.com>
> ---
>  qga/commands-posix.c | 3 +++
>  1 file changed, 3 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-08 17:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-08 16:11 [PATCH for-5.2] qga: fix missing closedir() in qmp_guest_get_disks() Michael Roth
2020-11-08 17:09 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).