Skip to content

Commit 3cb73bc

Browse files
ryncsnIngo Molnar
authored and
Ingo Molnar
committed
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 <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Dexuan Cui <[email protected]> Cc: Jake Oshins <[email protected]> Cc: Wei Hu <[email protected]> Cc: "K. Y. Srinivasan" <[email protected]> Cc: Haiyang Zhang <[email protected]> Cc: Stephen Hemminger <[email protected]> Link: https://lore.kernel.org/r/[email protected]
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)