]> www.infradead.org Git - users/jedix/linux-maple.git/commit
kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y
authorPetr Tesarik <ptesarik@suse.com>
Mon, 5 Aug 2024 15:07:50 +0000 (17:07 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 17 Aug 2024 00:51:43 +0000 (17:51 -0700)
commit441f53c6c5457b51bafa4c54ef21c43e60fd3e5c
tree63fe420d8db7f97e12a42368982508a529ef7303
parentd8d2b1fae63ab7da541e3e86fd7518bf00b7f206
kexec_file: fix elfcorehdr digest exclusion when CONFIG_CRASH_HOTPLUG=y

Fix the condition to exclude the elfcorehdr segment from the SHA digest
calculation.

The j iterator is an index into the output sha_regions[] array, not into
the input image->segment[] array.  Once it reaches
image->elfcorehdr_index, all subsequent segments are excluded.  Besides,
if the purgatory segment precedes the elfcorehdr segment, the elfcorehdr
may be wrongly included in the calculation.

Link: https://lkml.kernel.org/r/20240805150750.170739-1-petr.tesarik@suse.com
Fixes: f7cc804a9fd4 ("kexec: exclude elfcorehdr from the segment digest")
Signed-off-by: Petr Tesarik <ptesarik@suse.com>
Acked-by: Baoquan He <bhe@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Hari Bathini <hbathini@linux.ibm.com>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Eric DeVolder <eric_devolder@yahoo.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/kexec_file.c