"Das U-Boot" Source Tree
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

common/spl: handle properly images with bad checksum

load_simple_fit() returns -EPERM for the images with broken signatures.
Unfortunately this may conflict with image loaging selection on the base
of boot phase. See commit 873112db9ce68c38984ff25808dde726f8dd5573
("spl: Support selecting images based on phase in simple FIT").

Thus loading of

configurations {
uboot {
description = "u-boot";
firmware = "atf";
loadables = "atf", "tee", "uboot";
};
};

with damaged "tee" image may finish without errors. This may results in
board bricking.

This patch fixes commit 873112db9ce68c38984ff25808dde726f8dd5573
("spl: Support selecting images based on phase in simple FIT")
by replacing EPERM with EBADSLT places where it should be done.

Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>

authored by

Mikhail Kshevetskiy and committed by
Tom Rini
3eb43c54 3704b888

+4 -4
+4 -4
common/spl/spl_fit.c
··· 200 200 * the image gets loaded to the address pointed to by the 201 201 * load_addr member in this struct, if load_addr is not 0 202 202 * 203 - * Return: 0 on success, -EPERM if this image is not the correct phase 203 + * Return: 0 on success, -EBADSLT if this image is not the correct phase 204 204 * (for CONFIG_BOOTMETH_VBE_SIMPLE_FW), or another negative error number on 205 205 * other error. 206 206 */ ··· 236 236 return ret; 237 237 } else { 238 238 log_debug("- phase mismatch, skipping this image\n"); 239 - return -EPERM; 239 + return -EBADSLT; 240 240 } 241 241 } 242 242 ··· 475 475 image_info.load_addr = (ulong)tmpbuffer; 476 476 ret = load_simple_fit(info, offset, ctx, node, 477 477 &image_info); 478 - if (ret == -EPERM) 478 + if (ret == -EBADSLT) 479 479 continue; 480 480 else if (ret < 0) 481 481 break; ··· 835 835 836 836 image_info.load_addr = 0; 837 837 ret = load_simple_fit(info, offset, &ctx, node, &image_info); 838 - if (ret < 0 && ret != -EPERM) { 838 + if (ret < 0 && ret != -EBADSLT) { 839 839 printf("%s: can't load image loadables index %d (ret = %d)\n", 840 840 __func__, index, ret); 841 841 return ret;