Commit d5978a21 authored by Linus Torvalds's avatar Linus Torvalds

Partially undo Alan's recent tty locking fixes: the termios

lock must not be held across the driver/ldisc downcalls.

Some drivers need to set device state (baudrate etc) and may
need to sleep.
parent 6482f833
...@@ -145,6 +145,13 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios ...@@ -145,6 +145,13 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios
wake_up_interruptible(&tty->link->read_wait); wake_up_interruptible(&tty->link->read_wait);
} }
} }
/*
* Fixme! We should really try to protect the driver and ldisc
* termios usage too. But they need to be able to sleep, so
* the global termios spinlock is not the right thing.
*/
spin_unlock_irqrestore(&tty_termios_lock, flags);
if (tty->driver->set_termios) if (tty->driver->set_termios)
(*tty->driver->set_termios)(tty, &old_termios); (*tty->driver->set_termios)(tty, &old_termios);
...@@ -155,7 +162,6 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios ...@@ -155,7 +162,6 @@ static void change_termios(struct tty_struct * tty, struct termios * new_termios
(ld->set_termios)(tty, &old_termios); (ld->set_termios)(tty, &old_termios);
tty_ldisc_deref(ld); tty_ldisc_deref(ld);
} }
spin_unlock_irqrestore(&tty_termios_lock, flags);
} }
static int set_termios(struct tty_struct * tty, void __user *arg, int opt) static int set_termios(struct tty_struct * tty, void __user *arg, int opt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment