Close /dev/crypto file descriptor after CRIOGET ioctl().
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 7 Jan 2021 22:09:41 +0000 (14:09 -0800)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 11 Jan 2021 22:10:36 +0000 (14:10 -0800)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Ben Kaduk <kaduk@mit.edu>
(Merged from https://github.com/openssl/openssl/pull/13807)

engines/e_devcrypto.c

index d549edfd295aa2bfef5bd1d06afd95416905c3b4..e1c4372f729fb4d96dc774660e22fe91bae546f2 100644 (file)
@@ -1236,9 +1236,11 @@ static int open_devcrypto(void)
 #ifdef CRIOGET
     if (ioctl(fd, CRIOGET, &cfd) < 0) {
         fprintf(stderr, "Could not create crypto fd: %s\n", strerror(errno));
+        close(fd);
         cfd = -1;
         return 0;
     }
+    close(fd);
 #else
     cfd = fd;
 #endif