Skip to content

Commit 3cb73bc

Browse files
ryncsnIngo Molnar
authored andcommitted
hyperv_fb: Update screen_info after removing old framebuffer
On gen2 HyperV VM, hyperv_fb will remove the old framebuffer, and the new allocated framebuffer address could be at a differnt location, and it might be no longer a VGA framebuffer. Update screen_info so that after kexec the kernel won't try to reuse the old invalid/stale framebuffer address as VGA, corrupting memory. [ mingo: Tidied up the changelog. ] Signed-off-by: Kairui Song <kasong@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Dexuan Cui <decui@microsoft.com> Cc: Jake Oshins <jakeo@microsoft.com> Cc: Wei Hu <weh@microsoft.com> Cc: "K. Y. Srinivasan" <kys@microsoft.com> Cc: Haiyang Zhang <haiyangz@microsoft.com> Cc: Stephen Hemminger <sthemmin@microsoft.com> Link: https://lore.kernel.org/r/20201014092429.1415040-3-kasong@redhat.com
1 parent afc1806 commit 3cb73bc

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/video/fbdev/hyperv_fb.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,15 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
11141114
getmem_done:
11151115
remove_conflicting_framebuffers(info->apertures,
11161116
KBUILD_MODNAME, false);
1117-
if (!gen2vm)
1117+
1118+
if (gen2vm) {
1119+
/* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */
1120+
screen_info.lfb_size = 0;
1121+
screen_info.lfb_base = 0;
1122+
screen_info.orig_video_isVGA = 0;
1123+
} else {
11181124
pci_dev_put(pdev);
1125+
}
11191126
kfree(info->apertures);
11201127

11211128
return 0;

0 commit comments

Comments
 (0)