diff options
author | Suraj Jitindar Singh <sjitindarsingh@gmail.com> | 2017-09-19 14:38:06 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-09-19 04:16:37 -0500 |
commit | eeb4d3226d4eda49ca171d442e49ceccbcaf634e (patch) | |
tree | 562fb53d29df9d5c64ae4efd090ce8ca4083e3b8 /libpore | |
parent | 2226def0f65dfcb5b4d6a99c05b62d0691d6821b (diff) | |
download | skiboot-eeb4d3226d4eda49ca171d442e49ceccbcaf634e.zip skiboot-eeb4d3226d4eda49ca171d442e49ceccbcaf634e.tar.gz skiboot-eeb4d3226d4eda49ca171d442e49ceccbcaf634e.tar.bz2 |
core/flash: Only expect ELF header for BOOTKERNEL partition flash resource
When loading a flash resource which isn't signed (secure and trusted
boot) and which doesn't have a subpartition, we assume it's the
BOOTKERNEL since previously this was the only such resource. Thus we
also assumed it had an ELF header which we parsed to get the size of the
partition rather than trusting the actual_size field in the FFS header.
A previous commit (9727fe3 DT: Add ibm,firmware-versions node) added the
version resource which isn't signed and also doesn't have a subpartition,
thus we expect it to have an ELF header. It doesn't so we print the
error message "FLASH: Invalid ELF header part VERSION".
It is a fluke that this works currently since we load the secure boot
header unconditionally and this happen to be the same size as the
version partition. We also don't update the return code on error so
happen to return OPAL_SUCCESS.
To make this explicitly correct; only check for an ELF header if we are
loading the BOOTKERNEL resource, otherwise use the partition size from
the FFS header. Also set the return code on error so we don't
erroneously return OPAL_SUCCESS. Add a check that the resource will fit
in the supplied buffer to prevent buffer overrun.
Fixes: 9727fe3 (DT: Add ibm,firmware-versions node)
Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libpore')
0 files changed, 0 insertions, 0 deletions