[PATCH] prevent page fault from screen blanking code duringearly boot

From: Jan Beulich
Date: Wed Jun 15 2005 - 07:59:36 EST


(Sorry for the resend, I failed to add a proper subject on the first send.)

(Note: Patch also attached because the inline version is certain to get
line wrapped.)

When significant delays happen during boot (e.g. with a kernel debugger, but
the problem has also seen in other cases) the timeout for blanking the
console may trigger, but the work scheduler may not have been initialized,
yet. This previously led to a page fault due to a NULL pointer access.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

diff -Npru linux-2.6.12-rc6.base/drivers/char/vt.c linux-2.6.12-rc6/drivers/char/vt.c
--- linux-2.6.12-rc6.base/drivers/char/vt.c 2005-06-15 13:24:51.000000000 +0200
+++ linux-2.6.12-rc6/drivers/char/vt.c 2005-06-15 13:30:39.933774576 +0200
@@ -2867,6 +2867,10 @@ void unblank_screen(void)
*/
static void blank_screen_t(unsigned long dummy)
{
+ if (unlikely(!keventd_up())) {
+ mod_timer(&console_timer, jiffies + blankinterval);
+ return;
+ }
blank_timer_expired = 1;
schedule_work(&console_work);
}


(Note: Patch also attached because the inline version is certain to get
line wrapped.)

When significant delays happen during boot (e.g. with a kernel debugger, but
the problem has also seen in other cases) the timeout for blanking the
console may trigger, but the work scheduler may not have been initialized,
yet. This previously led to a page fault due to a NULL pointer access.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

diff -Npru linux-2.6.12-rc6.base/drivers/char/vt.c linux-2.6.12-rc6/drivers/char/vt.c
--- linux-2.6.12-rc6.base/drivers/char/vt.c 2005-06-15 13:24:51.000000000 +0200
+++ linux-2.6.12-rc6/drivers/char/vt.c 2005-06-15 13:30:39.933774576 +0200
@@ -2867,6 +2867,10 @@ void unblank_screen(void)
*/
static void blank_screen_t(unsigned long dummy)
{
+ if (unlikely(!keventd_up())) {
+ mod_timer(&console_timer, jiffies + blankinterval);
+ return;
+ }
blank_timer_expired = 1;
schedule_work(&console_work);
}