Skip to content

Commit f322a97

Browse files
Pratyush Yadavakpm00
authored andcommitted
kho: only fill kimage if KHO is finalized
kho_fill_kimage() only checks for KHO being enabled before filling in the FDT to the image. KHO being enabled does not mean that the kernel has data to hand over. That happens when KHO is finalized. When a kexec is done with KHO enabled but not finalized, the FDT page is allocated but not initialized. FDT initialization happens after finalize. This means the KHO segment is filled in but the FDT contains garbage data. This leads to the below error messages in the next kernel: [ 0.000000] KHO: setup: handover FDT (0x10116b000) is invalid: -9 [ 0.000000] KHO: disabling KHO revival: -22 There is no problem in practice, and the next kernel boots and works fine. But this still leads to misleading error messages and garbage being handed over. Only fill in KHO segment when KHO is finalized. When KHO is not enabled, the debugfs interface is not created and there is no way to finalize it anyway. So the check for kho_enable is not needed, and kho_out.finalize alone is enough. Link: https://lkml.kernel.org/r/[email protected] Fixes: 3bdecc3 ("kexec: add KHO support to kexec file loads") Signed-off-by: Pratyush Yadav <[email protected]> Reviewed-by: Mike Rapoport (Microsoft) <[email protected]> Cc: Alexander Graf <[email protected]> Cc: Baoquan He <[email protected]> Cc: Changyuan Lyu <[email protected]> Cc: Jason Gunthorpe <[email protected]> Cc: Pasha Tatashin <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 3437819 commit f322a97

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/kexec_handover.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ int kho_fill_kimage(struct kimage *image)
12531253
int err = 0;
12541254
struct kexec_buf scratch;
12551255

1256-
if (!kho_enable)
1256+
if (!kho_out.finalized)
12571257
return 0;
12581258

12591259
image->kho.fdt = page_to_phys(kho_out.ser.fdt);

0 commit comments

Comments
 (0)