aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKairui Song <[email protected]>2020-10-14 17:24:29 +0800
committerIngo Molnar <[email protected]>2020-10-14 17:05:26 +0200
commit3cb73bc3fa2a3cb80b88aa63b48409939e0d996b (patch)
tree6edcab69824ba2091be7575c6fec1f8683d6eac8
parentafc18069a2cb7ead5f86623a5f3d4ad6e21f940d (diff)
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]
-rw-r--r--drivers/video/fbdev/hyperv_fb.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 02411d89cb46..e36fb1a0ecdb 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -1114,8 +1114,15 @@ static int hvfb_getmem(struct hv_device *hdev, struct fb_info *info)
getmem_done:
remove_conflicting_framebuffers(info->apertures,
KBUILD_MODNAME, false);
- if (!gen2vm)
+
+ if (gen2vm) {
+ /* framebuffer is reallocated, clear screen_info to avoid misuse from kexec */
+ screen_info.lfb_size = 0;
+ screen_info.lfb_base = 0;
+ screen_info.orig_video_isVGA = 0;
+ } else {
pci_dev_put(pdev);
+ }
kfree(info->apertures);
return 0;