lkml.org 
[lkml]   [2002]   [Aug]   [5]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
FromArnd Bergmann <>
Subject[PATCH] 12/18 console_unblank bug fix
DateMon, 5 Aug 2002 19:47:55 +0200
Problem:  console_unblank can cause an endless trap loop if the console
          semaphore is already taken and console_unblank is called in
          interrupt context.
Solution: To avoid the trap loop just try to take the console semaphore
          with down_trylock and exit if it fails. It is not perfect
          since c->unblank() is not called in this case but way better
          than an endless trap loop. s390/s390x are the only two
          architectures that still use console_unblank. This patch
          has been accepted to 2.5.

diff -urN linux-2.4.19-rc3/kernel/printk.c linux-2.4.19-s390/kernel/printk.c
--- linux-2.4.19-rc3/kernel/printk.c	Tue Jul 30 09:02:32 2002
+++ linux-2.4.19-s390/kernel/printk.c	Tue Jul 30 09:02:57 2002
@@ -556,7 +556,14 @@
 {
 	struct console *c;
 
-	acquire_console_sem();
+	/*
+	 * Try to get the console semaphore. If someone else owns it
+	 * we have to return without unblanking because console_unblank
+	 * may be called in interrupt context.
+	 */
+	if (down_trylock(&console_sem) != 0)
+		return;
+	console_may_schedule = 0;
 	for (c = console_drivers; c != NULL; c = c->next)
 		if ((c->flags & CON_ENABLED) && c->unblank)
 			c->unblank();

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:27    [from the cache]
©2003-2008