fit: Handle decompression errors properly

Set payload to NULL in case of decompression errors.
Fixes the attempt to boot a kernel that couldn't be decompressed.

Change-Id: I3a602b0e90923a0b5a3683c4a0adf9e4733d5a2a
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/27970
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Patrick Rudolph 2018-08-09 09:08:05 +02:00 committed by Patrick Georgi
parent fb03dd6043
commit dfc30130e9
1 changed files with 2 additions and 0 deletions

View File

@ -163,6 +163,7 @@ void fit_payload(struct prog *payload)
if (config->ramdisk_node && if (config->ramdisk_node &&
extract(&initrd, config->ramdisk_node)) { extract(&initrd, config->ramdisk_node)) {
printk(BIOS_ERR, "ERROR: Failed to extract initrd\n"); printk(BIOS_ERR, "ERROR: Failed to extract initrd\n");
prog_set_entry(payload, NULL, NULL);
rdev_munmap(prog_rdev(payload), data); rdev_munmap(prog_rdev(payload), data);
return; return;
} }
@ -171,6 +172,7 @@ void fit_payload(struct prog *payload)
if (extract(&kernel, config->kernel_node)) { if (extract(&kernel, config->kernel_node)) {
printk(BIOS_ERR, "ERROR: Failed to extract kernel\n"); printk(BIOS_ERR, "ERROR: Failed to extract kernel\n");
prog_set_entry(payload, NULL, NULL);
rdev_munmap(prog_rdev(payload), data); rdev_munmap(prog_rdev(payload), data);
return; return;
} }