]>
Commit | Line | Data |
---|---|---|
77e25528 GKH |
1 | From a6dbe442755999960ca54a9b8ecfd9606be0ea75 Mon Sep 17 00:00:00 2001 |
2 | From: Nicolas Pitre <nicolas.pitre@linaro.org> | |
3 | Date: Mon, 11 Feb 2019 19:36:41 -0500 | |
4 | Subject: vt: perform safe console erase in the right order | |
5 | ||
6 | From: Nicolas Pitre <nicolas.pitre@linaro.org> | |
7 | ||
8 | commit a6dbe442755999960ca54a9b8ecfd9606be0ea75 upstream. | |
9 | ||
10 | Commit 4b4ecd9cb853 ("vt: Perform safe console erase only once") removed | |
11 | what appeared to be an extra call to scr_memsetw(). This missed the fact | |
12 | that set_origin() must be called before clearing the screen otherwise | |
13 | old screen content gets restored on the screen when using vgacon. Let's | |
14 | fix that by moving all the scrollback handling to flush_scrollback() | |
15 | where it logically belongs, and invoking it before the actual screen | |
16 | clearing in csi_J(), making the code simpler in the end. | |
17 | ||
18 | Reported-by: Matthew Whitehead <tedheadster@gmail.com> | |
19 | Signed-off-by: Nicolas Pitre <nico@linaro.org> | |
20 | Tested-by: Matthew Whitehead <tedheadster@gmail.com> | |
21 | Fixes: 4b4ecd9cb853 ("vt: Perform safe console erase only once") | |
22 | Cc: stable@vger.kernel.org | |
23 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
24 | ||
25 | --- | |
26 | drivers/tty/vt/vt.c | 15 +++++++-------- | |
27 | 1 file changed, 7 insertions(+), 8 deletions(-) | |
28 | ||
29 | --- a/drivers/tty/vt/vt.c | |
30 | +++ b/drivers/tty/vt/vt.c | |
31 | @@ -935,8 +935,11 @@ static void flush_scrollback(struct vc_d | |
32 | { | |
33 | WARN_CONSOLE_UNLOCKED(); | |
34 | ||
35 | + set_origin(vc); | |
36 | if (vc->vc_sw->con_flush_scrollback) | |
37 | vc->vc_sw->con_flush_scrollback(vc); | |
38 | + else | |
39 | + vc->vc_sw->con_switch(vc); | |
40 | } | |
41 | ||
42 | /* | |
43 | @@ -1506,8 +1509,10 @@ static void csi_J(struct vc_data *vc, in | |
44 | count = ((vc->vc_pos - vc->vc_origin) >> 1) + 1; | |
45 | start = (unsigned short *)vc->vc_origin; | |
46 | break; | |
47 | + case 3: /* include scrollback */ | |
48 | + flush_scrollback(vc); | |
49 | + /* fallthrough */ | |
50 | case 2: /* erase whole display */ | |
51 | - case 3: /* (and scrollback buffer later) */ | |
52 | vc_uniscr_clear_lines(vc, 0, vc->vc_rows); | |
53 | count = vc->vc_cols * vc->vc_rows; | |
54 | start = (unsigned short *)vc->vc_origin; | |
55 | @@ -1516,13 +1521,7 @@ static void csi_J(struct vc_data *vc, in | |
56 | return; | |
57 | } | |
58 | scr_memsetw(start, vc->vc_video_erase_char, 2 * count); | |
59 | - if (vpar == 3) { | |
60 | - set_origin(vc); | |
61 | - flush_scrollback(vc); | |
62 | - if (con_is_visible(vc)) | |
63 | - update_screen(vc); | |
64 | - } else if (con_should_update(vc)) | |
65 | - do_update_region(vc, (unsigned long) start, count); | |
66 | + update_region(vc, (unsigned long) start, count); | |
67 | vc->vc_need_wrap = 0; | |
68 | } | |
69 |