]> www.infradead.org Git - users/jedix/linux-maple.git/commit
efi: Handle memory error structures produced based on old versions of standard
authorLuck, Tony <tony.luck@intel.com>
Tue, 30 Jun 2015 22:57:51 +0000 (15:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 10 Aug 2015 19:21:57 +0000 (12:21 -0700)
commit07ddeec8a096a8d6e8be2af06703b3e828c15d59
treef8d3d74a73b531c01d3e19154be4cac62658dbd4
parent5728ec989adce2f303000b84469750579f162c2d
efi: Handle memory error structures produced based on old versions of standard

commit 4c62360d7562a20c996836d163259c87d9378120 upstream.

The memory error record structure includes as its first field a
bitmask of which subsequent fields are valid. The allows new fields
to be added to the structure while keeping compatibility with older
software that parses these records. This mechanism was used between
versions 2.2 and 2.3 to add four new fields, growing the size of the
structure from 73 bytes to 80. But Linux just added all the new
fields so this test:
if (gdata->error_data_length >= sizeof(*mem_err))
cper_print_mem(newpfx, mem_err);
else
goto err_section_too_small;
now make Linux complain about old format records being too short.

Add a definition for the old format of the structure and use that
for the minimum size check. Pass the actual size to cper_print_mem()
so it can sanity check the validation_bits field to ensure that if
a BIOS using the old format sets bits as if it were new, we won't
access fields beyond the end of the structure.

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efi/cper.c
include/linux/cper.h