diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-08-22 11:37:24 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-09-03 20:29:03 -0400 |
commit | 9fc2b2d0cf743008d8f6be6293278f4ef61f09f3 (patch) | |
tree | df7c30660be493aa9844da45f02c06097936f5b9 /drivers/char/vt.c | |
parent | 2bfc96a127bc1cc94d26bfaa40159966064f9c8c (diff) |
vt: Fix console corruption on driver hand-over.
After 02f0777a0d6560eb995aade34a1b82f95c0452da "vc_origin" is no
longer reset to the screen buffer before calling the con_init() hook
of the new console driver.
If the old driver wasn't using a fixed scanout buffer (e.g. the case
of vgacon) "vc_origin" may be a pointer to a VRAM location, and its
contents aren't guaranteed to be preserved after calling con_deinit()
on the old driver and con_init() on the new driver, i.e. the
subsequent console resize may fill the framebuffer with garbage.
It can be reproduced in the transition from vgacon to the nouveau
framebuffer driver: in that case the legacy VGA aperture "vc_origin"
points to becomes unreadable after fbcon_init().
This patch reverts the mentioned commit. To avoid the problem it
intended to fix, stop using "vc_scr_end" in vc_do_resize() to
calculate how many rows we have to copy (actually the code looks
simpler this way without the help of "vc_scr_end").
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Cc: qiaochong <qiaochong@loongson.cn>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r-- | drivers/char/vt.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 50590c7f2c01..281aada7b4a1 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -906,22 +906,16 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc, | |||
906 | * bottom of buffer | 906 | * bottom of buffer |
907 | */ | 907 | */ |
908 | old_origin += (old_rows - new_rows) * old_row_size; | 908 | old_origin += (old_rows - new_rows) * old_row_size; |
909 | end = vc->vc_scr_end; | ||
910 | } else { | 909 | } else { |
911 | /* | 910 | /* |
912 | * Cursor is in no man's land, copy 1/2 screenful | 911 | * Cursor is in no man's land, copy 1/2 screenful |
913 | * from the top and bottom of cursor position | 912 | * from the top and bottom of cursor position |
914 | */ | 913 | */ |
915 | old_origin += (vc->vc_y - new_rows/2) * old_row_size; | 914 | old_origin += (vc->vc_y - new_rows/2) * old_row_size; |
916 | end = old_origin + (old_row_size * new_rows); | ||
917 | } | 915 | } |
918 | } else | 916 | } |
919 | /* | 917 | |
920 | * Cursor near the top, copy contents from the top of buffer | 918 | end = old_origin + old_row_size * min(old_rows, new_rows); |
921 | */ | ||
922 | end = (old_rows > new_rows) ? old_origin + | ||
923 | (old_row_size * new_rows) : | ||
924 | vc->vc_scr_end; | ||
925 | 919 | ||
926 | update_attr(vc); | 920 | update_attr(vc); |
927 | 921 | ||
@@ -3075,8 +3069,7 @@ static int bind_con_driver(const struct consw *csw, int first, int last, | |||
3075 | 3069 | ||
3076 | old_was_color = vc->vc_can_do_color; | 3070 | old_was_color = vc->vc_can_do_color; |
3077 | vc->vc_sw->con_deinit(vc); | 3071 | vc->vc_sw->con_deinit(vc); |
3078 | if (!vc->vc_origin) | 3072 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; |
3079 | vc->vc_origin = (unsigned long)vc->vc_screenbuf; | ||
3080 | visual_init(vc, i, 0); | 3073 | visual_init(vc, i, 0); |
3081 | set_origin(vc); | 3074 | set_origin(vc); |
3082 | update_attr(vc); | 3075 | update_attr(vc); |