vgacon: unconfuse vc_origin when using soft scrollback
authorNicolas Pitre <nicolas.pitre@linaro.org>
Thu, 10 Jan 2019 21:33:55 +0000 (16:33 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 07:14:36 +0000 (08:14 +0100)
commitf4abbb16ed9add95be72e85b9b5db8529e736b74
tree66981abc20e17e030583fe8f1e08637ea78a754a
parenta912e16faeda0f047aa334d062b70f20126f48bc
vgacon: unconfuse vc_origin when using soft scrollback

commit bfd8d8fe98b8792f362cd210a7873969f8d2fc04 upstream.

When CONFIG_VGACON_SOFT_SCROLLBACK is selected, the VGA display memory
index and vc_visible_origin don't change when scrollback is activated.
The actual screen content is saved away and the scrollbackdata is copied
over it. However the vt code, and /dev/vcs devices in particular, still
expect vc_origin to always point at the actual screen content not the
displayed scrollback content.

So adjust vc_origin to point at the saved screen content when scrollback
is active and set it back to vc_visible_origin when restoring the screen.

This fixes /dev/vcsa<n> that return scrollback content when they
shouldn't (onli /dev/vcsa without a number should), and also fixes
/dev/vcsu that should return scrollback content when scrollback is
active but currently doesn't.

An unnecessary call to vga_set_mem_top() is also removed.

Signed-off-by: Nicolas Pitre <nico@linaro.org>
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/video/console/vgacon.c