File 0188-9pfs-fix-fd-leak-in-local_opendir.patch of Package qemu.19799
From: Greg Kurz <groug@kaod.org>
Date: Mon, 6 Mar 2017 17:34:01 +0100
Subject: 9pfs: fix fd leak in local_opendir()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Coverity issue CID1371731
Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
(cherry picked from commit faab207f115cf9738f110cb088ab35a4b7aef73a)
[BR: Fix and/or infrastructure for BSC#1020427 CVE-2016-9602]
Signed-off-by: Bruce Rogers <brogers@suse.com>
---
hw/9pfs/9p-local.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index 2d606447459bf507004bbabc7a83..4f93af2eb1f0af44b58b4a552f8f 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -435,6 +435,7 @@ static int local_opendir(FsContext *ctx,
stream = fdopendir(dirfd);
if (!stream) {
+ close(dirfd);
return -1;
}
fs->dir.stream = stream;