All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Kairui Song" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Kairui Song <kasong@redhat.com>, Ingo Molnar <mingo@kernel.org>,
	Dexuan Cui <decui@microsoft.com>,
	Jake Oshins <jakeo@microsoft.com>, Wei Hu <weh@microsoft.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>, x86 <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [tip: x86/urgent] hyperv_fb: Update screen_info after removing old framebuffer
Date: Wed, 14 Oct 2020 15:43:20 -0000	[thread overview]
Message-ID: <160269020010.7002.11896111566490290262.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20201014092429.1415040-3-kasong@redhat.com>

The following commit has been merged into the x86/urgent branch of tip:

Commit-ID:     3cb73bc3fa2a3cb80b88aa63b48409939e0d996b
Gitweb:        https://git.kernel.org/tip/3cb73bc3fa2a3cb80b88aa63b48409939e0d996b
Author:        Kairui Song <kasong@redhat.com>
AuthorDate:    Wed, 14 Oct 2020 17:24:29 +08:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Wed, 14 Oct 2020 17:05:26 +02:00

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
---
 drivers/video/fbdev/hyperv_fb.c |  9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index 02411d8..e36fb1a 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;

      reply	other threads:[~2020-10-14 15:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  9:24 [PATCH 0/2] x86/hyperv: fix kexec/kdump hang on some VMs Kairui Song
2020-10-14  9:24 ` Kairui Song
2020-10-14  9:24 ` [PATCH 1/2] x86/kexec: Use up-to-dated screen_info copy to fill boot params Kairui Song
2020-10-14  9:24   ` Kairui Song
2020-10-14 15:43   ` [tip: x86/urgent] " tip-bot2 for Kairui Song
2020-10-27 20:07     ` Thomas Gleixner
2020-11-17  3:39   ` [PATCH 1/2] " Dexuan Cui
2020-11-17  3:39     ` Dexuan Cui
2020-11-25 23:39     ` Dexuan Cui
2020-11-25 23:39       ` Dexuan Cui
2020-10-14  9:24 ` [PATCH 2/2] hyperv_fb: Update screen_info after removing old framebuffer Kairui Song
2020-10-14  9:24   ` Kairui Song
2020-10-14 15:43   ` tip-bot2 for Kairui Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=160269020010.7002.11896111566490290262.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=jakeo@microsoft.com \
    --cc=kasong@redhat.com \
    --cc=kys@microsoft.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=sthemmin@microsoft.com \
    --cc=weh@microsoft.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.