WSL2-Linux-Kernel/drivers/tty
Paul Fulghum 1035b63d3c n_hdlc: fix read and write locking
Fix locking in read and write code of n_hdlc line discipline.

2.6.36 replaced lock_kernel() with tty_lock().  The tty mutex is not
dropped automatically when the thread sleeps like the BKL.  This results
in a blocked read or write holding the tty mutex and stalling operations
by other devices that use the tty mutex.

A review of n_hdlc read and write code shows:
1. neither BKL or tty mutex are required for correct operation
2. read can block while read data is available if data is posted
   between availability check and call to interruptible_sleep_on()
3. write does not set process state to TASK_INTERRUPTIBLE
   on each pass through the processing loop which can cause
   unneeded scheduling of the thread

The unnecessary tty mutex references have been removed.

Read changed to use same code as n_tty read
for completing reads and blocking.

Write corrected to set process state to TASK_INTERRUPTIBLE on each pass
through processing loop.

Signed-off-by: Paul Fulghum <paulkf@microgate.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-01-22 19:15:01 -08:00
..
hvc tty: move hvc drivers to drivers/tty/hvc/ 2011-01-13 12:03:00 -08:00
serial serial: unbreak billionton CF card 2011-01-22 19:15:01 -08:00
vt tty: use for_each_console() and WARN() on sysfs failures 2011-01-22 19:15:00 -08:00
Makefile tty: move drivers/serial/ to drivers/tty/serial/ 2011-01-13 12:10:18 -08:00
n_gsm.c Merge branch 'tty-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6 2011-01-07 14:39:20 -08:00
n_hdlc.c n_hdlc: fix read and write locking 2011-01-22 19:15:01 -08:00
n_r3964.c
n_tty.c
pty.c
sysrq.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2010-11-19 10:31:04 -08:00
tty_audit.c
tty_buffer.c tty: prevent DOS in the flush_to_ldisc 2010-11-09 15:02:02 -08:00
tty_io.c tty: use for_each_console() and WARN() on sysfs failures 2011-01-22 19:15:00 -08:00
tty_ioctl.c
tty_ldisc.c TTY: ldisc, fix open flag handling 2010-11-29 14:51:54 -08:00
tty_mutex.c
tty_port.c