Linux-Integrity Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ima-evm-utils: Fix possible DIR leak in find
@ 2019-09-01 18:20 Vitaly Chikunov
  0 siblings, 0 replies; only message in thread
From: Vitaly Chikunov @ 2019-09-01 18:20 UTC (permalink / raw)
  To: Mimi Zohar, Dmitry Kasatkin, linux-integrity

DIR is not closed if chdir errors occur.

Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
 src/evmctl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/evmctl.c b/src/evmctl.c
index 53711f4..b65139b 100644
--- a/src/evmctl.c
+++ b/src/evmctl.c
@@ -1344,6 +1344,7 @@ static int find(const char *path, int dts, find_cb_t func)
 
 	if (fchdir(dirfd(dir))) {
 		log_err("Failed to chdir %s\n", path);
+		closedir(dir);
 		return -1;
 	}
 
@@ -1359,6 +1360,7 @@ static int find(const char *path, int dts, find_cb_t func)
 
 	if (chdir("..")) {
 		log_err("Failed to chdir: %s\n", path);
+		closedir(dir);
 		return -1;
 	}
 
-- 
2.11.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-01 18:20 [PATCH] ima-evm-utils: Fix possible DIR leak in find Vitaly Chikunov

Linux-Integrity Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-integrity/0 linux-integrity/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-integrity linux-integrity/ https://lore.kernel.org/linux-integrity \
		linux-integrity@vger.kernel.org linux-integrity@archiver.kernel.org
	public-inbox-index linux-integrity


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-integrity


AGPL code for this site: git clone https://public-inbox.org/ public-inbox