Skip to content

Commit 99dc4da

Browse files
ryncsngregkh
authored andcommitted
x86/kexec: Use up-to-dated screen_info copy to fill boot params
[ Upstream commit afc1806 ] kexec_file_load() currently reuses the old boot_params.screen_info, but if drivers have change the hardware state, boot_param.screen_info could contain invalid info. For example, the video type might be no longer VGA, or the frame buffer address might be changed. If the kexec kernel keeps using the old screen_info, kexec'ed kernel may attempt to write to an invalid framebuffer memory region. There are two screen_info instances globally available, boot_params.screen_info and screen_info. Later one is a copy, and is updated by drivers. So let kexec_file_load use the updated copy. [ mingo: Tidied up the changelog. ] Signed-off-by: Kairui Song <kasong@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/20201014092429.1415040-2-kasong@redhat.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ae396da commit 99dc4da

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

arch/x86/kernel/kexec-bzimage64.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params,
200200
params->hdr.hardware_subarch = boot_params.hdr.hardware_subarch;
201201

202202
/* Copying screen_info will do? */
203-
memcpy(&params->screen_info, &boot_params.screen_info,
204-
sizeof(struct screen_info));
203+
memcpy(&params->screen_info, &screen_info, sizeof(struct screen_info));
205204

206205
/* Fill in memsize later */
207206
params->screen_info.ext_mem_k = 0;

0 commit comments

Comments
 (0)