[PATCH v2 1/4] kexec/kexec.c: Add the missing close() for fd used for kexec_file_load()

Bhupesh Sharma bhsharma at redhat.com
Sun Jul 14 23:02:53 PDT 2019


In kexec/kexec.c, we open() the kernel Image file and pass this file
descriptor to the kexec_file_load() system call, but never call a
corresponding close().

Fix the same via this patch.

Signed-off-by: Bhupesh Sharma <bhsharma at redhat.com>
---
 kexec/kexec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kexec/kexec.c b/kexec/kexec.c
index 32ae56c8f1c3..8ca3b457cac8 100644
--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -1234,6 +1234,8 @@ static int do_kexec_file_load(int fileind, int argc, char **argv,
 	if (ret != 0)
 		fprintf(stderr, "kexec_file_load failed: %s\n",
 					strerror(errno));
+
+	close(kernel_fd);
 	return ret;
 }
 
-- 
2.7.4




More information about the kexec mailing list