XTENSA: iss/console, fix potential deadlock
authorJiri Slaby <jslaby@suse.cz>
Mon, 5 Mar 2012 13:52:06 +0000 (14:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Mar 2012 19:47:01 +0000 (11:47 -0800)
If the timer ticks while we are holding the spinlock, the system
deadlocks. It is due to synchronous del_timer.

So to fix that, use spinlocks that properly disable bottom halves.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Chris Zankel <chris@zankel.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/xtensa/platforms/iss/console.c

index 01842e4d190403398dd6f4baf7b3ad7c50d8505d..94ab8eca9d77a214b5a6d6762d153693ba9b3a40 100644 (file)
@@ -91,11 +91,10 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
  */
 static void rs_close(struct tty_struct *tty, struct file * filp)
 {
-       spin_lock(&timer_lock);
+       spin_lock_bh(&timer_lock);
        if (tty->count == 1)
-               /* this will cause a deadlock if the timer ticks right now */
                del_timer_sync(&serial_timer);
-       spin_unlock(&timer_lock);
+       spin_unlock_bh(&timer_lock);
 }