summaryrefslogtreecommitdiffstats
path: root/drivers/char/vt.c
diff options
context:
space:
mode:
authorqiaochong <qiaochong@loongson.cn>2010-08-09 17:21:23 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2010-08-09 20:45:11 -0700
commit02f0777a0d6560eb995aade34a1b82f95c0452da (patch)
tree5d4b4f09c3345a4a84c5ebc85b037540c39c63fc /drivers/char/vt.c
parenta8618a0e8a06f75c6efec2a5477861d704d48b28 (diff)
downloadlinux-02f0777a0d6560eb995aade34a1b82f95c0452da.tar.gz
linux-02f0777a0d6560eb995aade34a1b82f95c0452da.tar.bz2
linux-02f0777a0d6560eb995aade34a1b82f95c0452da.zip
drivers/char/vt.c: fix vc->vc_origin on take_over_console()
kernel will die on some platform when switch from vga mode to framebuffer mode. The reason of this bug is that bind_con_driver reset vc->vc_origin to (unsigned long)vc->vc_screenbuf. On vgacon vc->vc_origin is not releated to vc->vc_screenbuf,if set vc->vc_origin to vc->vc_screenbuf,kernel will die on vc_do_resize. static int vc_do_resize(struct tty_struct *tty, struct tty_struct *real_tty, struct vc_data *vc, unsigned int cols, unsigned int lines) { unsigned long old_origin, new_origin, new_scr_end, rlth, rrem, err = 0; unsigned int old_cols, old_rows, old_row_size, old_screen_size; unsigned int new_cols, new_rows, new_row_size, new_screen_size; unsigned int end, user; ... end = (old_rows > new_rows) ? old_origin + (old_row_size * new_rows) : vc->vc_scr_end; ... /* here for a test from vgacon to framebuffer: old_origin=0x810814a0,end=0xb00b8fa0,vc->vc_origin=0x810814a0 the code bellow will copy memory from 0x810814a0 to 0xb00b8fa0, this will cover kernel code,kernel died here. */ while (old_origin < end) { scr_memcpyw((unsigned short *) new_origin, (unsigned short *) old_origin, rlth); if (rrem) scr_memsetw((void *)(new_origin + rlth), vc->vc_video_erase_char, rrem); old_origin += old_row_size; new_origin += new_row_size; } ... } [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: qiaochong <qiaochong@loongson.cn> Cc: Greg KH <greg@kroah.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/vt.c')
-rw-r--r--drivers/char/vt.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index 4a9eb3044e52..cff1d4bce21d 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -3065,7 +3065,8 @@ static int bind_con_driver(const struct consw *csw, int first, int last,
old_was_color = vc->vc_can_do_color;
vc->vc_sw->con_deinit(vc);
- vc->vc_origin = (unsigned long)vc->vc_screenbuf;
+ if (!vc->vc_origin)
+ vc->vc_origin = (unsigned long)vc->vc_screenbuf;
visual_init(vc, i, 0);
set_origin(vc);
update_attr(vc);