[PATCH] image: Adjust the workings of fit_check_format()
authorSimon Glass <sjg@chromium.org>
Tue, 16 Feb 2021 00:08:09 +0000 (17:08 -0700)
committerRaspbian forward porter <root@raspbian.org>
Mon, 18 May 2026 02:33:18 +0000 (02:33 +0000)
commitb9ec2e2f69e6ffd4d4d5e1bf59d7dd381677f8cf
treef326f1cfb1d0d987a3a829c261e9685923c0e972
parentf51bd580d9503e4391d0f54d468560e0e4f867ed
[PATCH] image: Adjust the workings of fit_check_format()

At present this function does not accept a size for the FIT. This means
that it must be read from the FIT itself, introducing potential security
risk. Update the function to include a size parameter, which can be
invalid, in which case fit_check_format() calculates it.

For now no callers pass the size, but this can be updated later.

Also adjust the return value to an error code so that all the different
types of problems can be distinguished by the user.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Bruce Monroe <bruce.monroe@intel.com>
Reported-by: Arie Haenel <arie.haenel@intel.com>
Reported-by: Julien Lenoir <julien.lenoir@intel.com>
This patch includes this one as well:
https://github.com/u-boot/u-boot/commit/ea1a9ec5f430359720d9a0621ed1acfbba6a142a.patch

Reviewed-By: Daniel Leidert <dleidert@debian.org>
Origin: https://github.com/u-boot/u-boot/commit/c5819701a3de61e2ba2ef7ad0b616565b32305e5
Origin: https://github.com/u-boot/u-boot/commit/ea1a9ec5f430359720d9a0621ed1acfbba6a142a
Bug: https://github.com/advisories/GHSA-3w66-96j7-fmcp
Bug-Debian: https://bugs.debian.org/983270
Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2021-27097
Bug-Freexian-Security: https://deb.freexian.com/extended-lts/tracker/CVE-2021-27097

Gbp-Pq: Name CVE-2021-27097-2.patch
18 files changed:
arch/arm/cpu/armv8/sec_firmware.c
cmd/bootm.c
cmd/disk.c
cmd/fpga.c
cmd/nand.c
cmd/source.c
cmd/ximg.c
common/image-fdt.c
common/image-fit.c
common/splash_source.c
common/update.c
drivers/fpga/socfpga_arria10.c
drivers/net/fsl-mc/mc.c
drivers/net/pfe_eth/pfe_firmware.c
include/image.h
tools/fit_common.c
tools/fit_image.c
tools/mkimage.h