Skip to contentSkip to conversation

Fix fd leakage in uki_image_probe()

PATCH Applied Pingfan Liu 2 participants 2 messages Nov 4, 2024 – Nov 6, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix fd leakage in uki_image_probe()

There is a fd leakage in the fail path when writing to initrd fd in uki_image_probe(). Fix it by this patch.

To: [email protected]

---
 kexec/kexec-uki.c | 1 +
 1 file changed, 1 insertion(+)
kexec/kexec-uki.c +1 -0
index 202fd89..210ebb6 100644
@@ -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);
Signature · 7 lines
2.41.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec