From 019d8258f15c2a716786880c3cbd0f327a4dfc09 Mon Sep 17 00:00:00 2001 From: Bhupesh Sharma Date: Mon, 15 Jul 2019 11:32:53 +0530 Subject: [PATCH 1/5] kexec/kexec.c: Add the missing close() for fd used for kexec_file_load() 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 Signed-off-by: Simon Horman --- 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