[PATCH] drivers/char/console.c and reentering

From: Petr Vandrovec (vandrove@vc.cvut.cz)
Date: Wed May 31 2000 - 11:59:32 EST


Hi Alan
  as nobody answered to my mail from Monday, please apply
this patch to 2.4.0-test1. It fixes one codepath which was
proven that there is missing lock. Patch was generated
against 2.4.0-test1-ac7.

  I tried to verify all other callers of set_cursor and
I believe that others are safe - or at least immediate callers
of set_cursor are at least sometime called with console_lock
held. But there are some callers (set_selection,
complete_change_console) for which I was not able to verify
whether they are called with lock held or not.

  I'm using this change since monday on my SMP system and
I do not see any bad effect - only one good that fbdev is
no more reentered.
                                Thanks,
                                        Petr Vandrovec
                                        vandrove@vc.cvut.cz

diff -urdN linux/drivers/char/console.c linux/drivers/char/console.c
--- linux/drivers/char/console.c Sun Apr 2 22:20:27 2000
+++ linux/drivers/char/console.c Wed May 31 15:52:52 2000
@@ -2290,10 +2290,13 @@
 
 static void con_flush_chars(struct tty_struct *tty)
 {
+ unsigned long flags;
         struct vt_struct *vt = (struct vt_struct *)tty->driver_data;
 
         pm_access(pm_con);
+ spin_lock_irqsave(&console_lock, flags);
         set_cursor(vt->vc_num);
+ spin_unlock_irqrestore(&console_lock, flags);
 }
 
 /*

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



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:28 EST