Skip to content

Commit 6dacd79

Browse files
ptesarikakpm00
authored andcommitted
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/[email protected] Fixes: f7cc804 ("kexec: exclude elfcorehdr from the segment digest") Signed-off-by: Petr Tesarik <[email protected]> Acked-by: Baoquan He <[email protected]> Cc: Eric Biederman <[email protected]> Cc: Hari Bathini <[email protected]> Cc: Sourabh Jain <[email protected]> Cc: Eric DeVolder <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent ab7ca09 commit 6dacd79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/kexec_file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ static int kexec_calculate_store_digests(struct kimage *image)
752752

753753
#ifdef CONFIG_CRASH_HOTPLUG
754754
/* Exclude elfcorehdr segment to allow future changes via hotplug */
755-
if (j == image->elfcorehdr_index)
755+
if (i == image->elfcorehdr_index)
756756
continue;
757757
#endif
758758

0 commit comments

Comments
 (0)