]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.25.19/fbcon_set_all_vcs-fix-kernel-crash-when-switching-the-rotated-consoles.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 2.6.25.19 / fbcon_set_all_vcs-fix-kernel-crash-when-switching-the-rotated-consoles.patch
1 From jejb@kernel.org Thu Oct 16 14:54:47 2008
2 From: Oleg Nesterov <oleg@tv-sign.ru>
3 Date: Thu, 16 Oct 2008 19:05:07 GMT
4 Subject: fbcon_set_all_vcs: fix kernel crash when switching the rotated consoles
5 To: jejb@kernel.org, stable@kernel.org
6 Message-ID: <200810161905.m9GJ57Ki013495@hera.kernel.org>
7
8 From: Oleg Nesterov <oleg@tv-sign.ru>
9
10 commit 232fb69a53a5ec3f22a8104d447abe4806848a8f upstream
11
12 echo 3 >> /sys/class/graphics/fbcon/rotate_all, then switch to another
13 console. Result:
14
15 BUG: unable to handle kernel paging request at ffffc20005d00000
16 IP: [bitfill_aligned+149/265] bitfill_aligned+0x95/0x109
17 PGD 7e228067 PUD 7e229067 PMD 7bc1f067 PTE 0
18 Oops: 0002 [1] SMP
19 CPU 1
20 Modules linked in: [...a lot...]
21 Pid: 10, comm: events/1 Not tainted 2.6.26.5-45.fc9.x86_64 #1
22 RIP: 0010:[bitfill_aligned+149/265] [bitfill_aligned+149/265] bitfill_aligned+0x95/0x109
23 RSP: 0018:ffff81007d811bc8 EFLAGS: 00010216
24 RAX: ffffc20005d00000 RBX: 0000000000000000 RCX: 0000000000000400
25 RDX: 0000000000000000 RSI: ffffc20005d00000 RDI: ffffffffffffffff
26 RBP: ffff81007d811be0 R08: 0000000000000400 R09: 0000000000000040
27 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000010000
28 R13: ffffffff811632f0 R14: 0000000000000006 R15: ffff81007cb85400
29 FS: 0000000000000000(0000) GS:ffff81007e004780(0000) knlGS:0000000000000000
30 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
31 CR2: ffffc20005d00000 CR3: 0000000000201000 CR4: 00000000000006e0
32 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
33 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
34 Process events/1 (pid: 10, threadinfo ffff81007d810000, task ffff81007d808000)
35 Stack: ffff81007c9d75a0 0000000000000000 0000000000000000 ffff81007d811c80
36 ffffffff81163a61 ffff810000000000 ffffffff8115f9c8 0000001000000000
37 0000000100aaaaaa 000000007cd0d4a0 fffffd8a00000800 0001000000000000
38 Call Trace:
39 [cfb_fillrect+523/798] cfb_fillrect+0x20b/0x31e
40 [soft_cursor+416/436] ? soft_cursor+0x1a0/0x1b4
41 [ccw_clear_margins+205/263] ccw_clear_margins+0xcd/0x107
42 [fbcon_clear_margins+59/61] fbcon_clear_margins+0x3b/0x3d
43 [fbcon_switch+1291/1466] fbcon_switch+0x50b/0x5ba
44 [redraw_screen+261/481] redraw_screen+0x105/0x1e1
45 [ccw_cursor+0/1869] ? ccw_cursor+0x0/0x74d
46 [complete_change_console+48/190] complete_change_console+0x30/0xbe
47 [change_console+115/120] change_console+0x73/0x78
48 [console_callback+0/292] ? console_callback+0x0/0x124
49 [console_callback+97/292] console_callback+0x61/0x124
50 [schedule_delayed_work+25/30] ? schedule_delayed_work+0x19/0x1e
51 [run_workqueue+139/282] run_workqueue+0x8b/0x11a
52 [worker_thread+221/238] worker_thread+0xdd/0xee
53 [autoremove_wake_function+0/56] ? autoremove_wake_function+0x0/0x38
54 [worker_thread+0/238] ? worker_thread+0x0/0xee
55 [kthread+73/118] kthread+0x49/0x76
56 [child_rip+10/18] child_rip+0xa/0x12
57 [kthread+0/118] ? kthread+0x0/0x76
58 [child_rip+0/18] ? child_rip+0x0/0x12
59
60 Because fbcon_set_all_vcs()->FBCON_SWAP() uses display->rotate == 0 instead
61 of fbcon_ops->rotate, and vc_resize() has no effect because it is called with
62 new_cols/rows == ->vc_cols/rows.
63
64 Tested on 2.6.26.5-45.fc9.x86_64, but
65 http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git seems to
66 have the same problem.
67
68 Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
69 Cc: Krzysztof Helt <krzysztof.h1@poczta.fm>
70 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
71 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
72 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
73
74 ---
75 drivers/video/console/fbcon.c | 4 ++--
76 1 file changed, 2 insertions(+), 2 deletions(-)
77
78 --- a/drivers/video/console/fbcon.c
79 +++ b/drivers/video/console/fbcon.c
80 @@ -2974,8 +2974,8 @@ static void fbcon_set_all_vcs(struct fb_
81 p = &fb_display[vc->vc_num];
82 set_blitting_type(vc, info);
83 var_to_display(p, &info->var, info);
84 - cols = FBCON_SWAP(p->rotate, info->var.xres, info->var.yres);
85 - rows = FBCON_SWAP(p->rotate, info->var.yres, info->var.xres);
86 + cols = FBCON_SWAP(ops->rotate, info->var.xres, info->var.yres);
87 + rows = FBCON_SWAP(ops->rotate, info->var.yres, info->var.xres);
88 cols /= vc->vc_font.width;
89 rows /= vc->vc_font.height;
90 vc_resize(vc, cols, rows);