Re: possible locking bug in tty_open

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alan Cox
Date: Tuesday, May 4, 2010 - 12:42 pm

On Sun, 2 May 2010 22:47:33 +0200
Arnd Bergmann <arnd@arndb.de> wrote:


I think all we need is probably this

tty: Fix unbalanced BKL handling in error path
    
Arnd noted:
    
After the "retry_open:" label, we first get the tty_mutex
and then the BKL. However a the end of tty_open, we jump
back to retry_open with the BKL still held. If we run into
this case, the tty_open function will be left with the BKL
still held.
    
Signed-off-by: Alan Cox <alan@linux.intel.com>

diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 6da962c..fe810a7 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -1875,6 +1875,7 @@ got_driver:
 		 */
 		if (filp->f_op == &hung_up_tty_fops)
 			filp->f_op = &tty_fops;
+		unlock_kernel();
 		goto retry_open;
 	}
 	unlock_kernel();
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
possible locking bug in tty_open, Arnd Bergmann, (Sun May 2, 1:47 pm)
Re: possible locking bug in tty_open, Alan Cox, (Tue May 4, 2:43 am)
Re: possible locking bug in tty_open, Alan Cox, (Tue May 4, 12:42 pm)
Re: possible locking bug in tty_open, Arnd Bergmann, (Tue May 4, 1:26 pm)