* [PATCH] Fix fd leakage in uki_image_probe()
@ 2024-11-04 13:07 Pingfan Liu
2024-11-06 9:28 ` Simon Horman
0 siblings, 1 reply; 2+ messages in thread
From: Pingfan Liu @ 2024-11-04 13:07 UTC (permalink / raw)
To: kexec; +Cc: Pingfan Liu, Simon Horman
There is a fd leakage in the fail path when writing to initrd fd in
uki_image_probe(). Fix it by this patch.
Signed-off-by: Pingfan Liu <piliu@redhat.com>
Cc: Simon Horman <horms@kernel.org>
To: kexec@lists.infradead.org
---
kexec/kexec-uki.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kexec/kexec-uki.c b/kexec/kexec-uki.c
index 202fd89..210ebb6 100644
--- a/kexec/kexec-uki.c
+++ b/kexec/kexec-uki.c
@@ -77,6 +77,7 @@ int uki_image_probe(const char *file_buf, off_t buf_sz)
sect_hdr->raw_data_size) != sect_hdr->raw_data_size) {
dbgprintf("%s: Can't write the compressed file %s\n",
__func__, initrd_fname);
+ close(initrd_fd);
goto next;
} else {
implicit_initrd_fd = open(initrd_fname, O_RDONLY);
--
2.41.0
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-06 9:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 13:07 [PATCH] Fix fd leakage in uki_image_probe() Pingfan Liu
2024-11-06 9:28 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox