linux/drivers/tty
Jiri Slaby 3fa10cc83f TTY: n_tty, do not dereference user buffer
copy_from_read_buf currently copies data to a user buffer and then
checks if the data is single EOF. But it checks it by accessing the
user buffer. First, the buffer may be changed by other threads of the
user program already. Second, it accesses the buffer without any
checks. It might be write-only for example.

Fix this by inspecting contents of the tty (kernel) buffer instead.
Note that "n == 1" is necessary, but not sufficient. But we check
later that there is nothing left by "!tty->read_cnt" condition.

There is still an issue with the current code that EOF being wrapped
to the start of the circular buffer will result in an inappropriate
losing of the EOF character. But this is not intended to be fixed by
this patch.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: Emil Goode <emilgoode@gmail.com>
Cc: Howard Chu <hyc@symas.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-29 22:13:54 -04:00
..
hvc TTY: hvc, fix TTY refcounting 2012-04-13 10:54:43 -07:00
ipwireless TTY: ipwireless, use tty from tty_port 2012-04-09 11:30:39 -07:00
serial Merge 3.4-rc4 into tty-next 2012-04-23 09:39:23 -07:00
vt vt: push the tty_lock down into the map handling 2012-04-24 16:14:14 -07:00
amiserial.c drivers/tty/amiserial.c: add missing tty_unlock 2012-04-19 19:15:35 -07:00
bfin_jtag_comm.c TTY: bfin_jtag_comm, use tty from tty_port 2012-04-09 11:28:18 -07:00
cyclades.c
ehv_bytechan.c
isicom.c Documentation: remove references to /etc/modprobe.conf 2012-03-30 16:03:15 -07:00
Kconfig
Makefile
moxa.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
moxa.h
mxser.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
mxser.h
n_gsm.c
n_hdlc.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
n_r3964.c
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c TTY: n_tty, do not dereference user buffer 2012-04-29 22:13:54 -04:00
nozomi.c
pty.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
rocket_int.h
rocket.c
rocket.h
synclink_gt.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
synclink.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
synclinkmp.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
sysrq.c sysrq: use SEND_SIG_FORCED instead of force_sig() 2012-04-05 15:25:50 -07:00
tty_audit.c
tty_buffer.c tty: hold lock across tty buffer finding and buffer filling 2012-04-09 12:12:45 -07:00
tty_io.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
tty_ioctl.c Remove all #inclusions of asm/system.h 2012-03-28 18:30:03 +01:00
tty_ldisc.c
tty_mutex.c
tty_port.c