From a12c6442f24a32867c971b6feb5db61d01b02c1f Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 7 Jan 2021 14:09:41 -0800 Subject: [PATCH] Close /dev/crypto file descriptor after CRIOGET ioctl(). Reviewed-by: Matt Caswell Reviewed-by: Ben Kaduk (cherry picked from commit 3ddf44ea5a2c1c8c55f4f4072a611791c79d4e7c) Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/13853) --- crypto/engine/eng_devcrypto.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/engine/eng_devcrypto.c b/crypto/engine/eng_devcrypto.c index f03c0171813..997271e1505 100644 --- a/crypto/engine/eng_devcrypto.c +++ b/crypto/engine/eng_devcrypto.c @@ -771,9 +771,11 @@ void engine_load_devcrypto_int() #ifdef CRIOGET if (ioctl(fd, CRIOGET, &cfd) < 0) { fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno)); + close(fd); cfd = -1; return; } + close(fd); #else cfd = fd; #endif -- 2.47.2