Re: [PATCH v5 4/4] efi/cper: don't dump the entire memory region
From: Jonathan Cameron
Date: Wed Jan 07 2026 - 12:53:14 EST
On Wed, 7 Jan 2026 17:41:52 +0100
Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx> wrote:
> The current logic at cper_print_fw_err() doesn't check if the
> error record length is big enough to handle offset. On a bad firmware,
> if the ofset is above the actual record, length -= offset will
> underflow, making it dump the entire memory.
>
> The end result can be:
>
> - the logic taking a lot of time dumping large regions of memory;
> - data disclosure due to the memory dumps;
> - an OOPS, if it tries to dump an unmapped memory region.
>
> Fix it by checking if the section length is too small before doing
> a hex dump.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
Reviewed-by: Jonathan Cameron <jonathan.cameron@xxxxxxxxxx>