linux/drivers/tty
Christian Riesch 7810e6d8f1 n_tty: Fix read_buf race condition, increment read_head after pushing data
commit 8bfbe2de76 upstream.

Commit 19e2ad6a09 ("n_tty: Remove overflow
tests from receive_buf() path") moved the increment of read_head into
the arguments list of read_buf_addr(). Function calls represent a
sequence point in C. Therefore read_head is incremented before the
character c is placed in the buffer. Since the circular read buffer is
a lock-less design since commit 6d76bd2618
("n_tty: Make N_TTY ldisc receive path lockless"), this creates a race
condition that leads to communication errors.

This patch modifies the code to increment read_head _after_ the data
is placed in the buffer and thus fixes the race for non-SMP machines.
To fix the problem for SMP machines, memory barriers must be added in
a separate patch.

Signed-off-by: Christian Riesch <christian.riesch@omicron.at>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-01-16 06:59:32 -08:00
..
hvc drivers/tty/hvc: don't free hvc_console_setup after init 2014-05-13 13:32:46 +02:00
ipwireless tty: Fix low_latency BUG 2014-04-26 17:19:04 -07:00
serial serial: samsung: wait for transfer completion before clock disable 2015-01-16 06:59:32 -08:00
vt vt: Fix secure clear screen 2014-02-13 11:12:00 -08:00
Kconfig drivers/tty: ehv_bytechan fails to build as a module 2014-01-09 17:52:12 -06:00
Makefile
amiserial.c tty/amiserial: avoid interruptible_sleep_on 2014-01-07 17:05:21 -08:00
bfin_jtag_comm.c TTY: bfin_jtag_comm: fix incorrect placement of __initdata tag 2013-09-30 19:09:37 -07:00
cyclades.c tty: an overflow of multiplication in drivers/tty/cyclades.c 2013-12-20 12:21:57 -08:00
ehv_bytechan.c drivers: clean-up prom.h implicit includes 2013-10-09 20:04:04 -05:00
goldfish.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00
isicom.c
metag_da.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
moxa.c
moxa.h
mxser.c
mxser.h
n_gsm.c tty: n_gsm: Fix for modems with brk in modem status control 2014-02-07 08:40:54 -08:00
n_hdlc.c
n_r3964.c tty: Always handle NULL flag ptr 2013-12-08 16:56:05 -08:00
n_tracerouter.c
n_tracesink.c
n_tracesink.h
n_tty.c n_tty: Fix read_buf race condition, increment read_head after pushing data 2015-01-16 06:59:32 -08:00
nozomi.c tty: Remove unnecessary semicolons 2013-10-16 13:08:16 -07:00
pty.c
rocket.c tty: remove DEFINE_PCI_DEVICE_TABLE macro 2013-12-08 17:09:07 -08:00
rocket.h
rocket_int.h
synclink.c tty: synclink: avoid sleep_on race 2014-01-07 17:05:21 -08:00
synclink_gt.c tty: synclink: avoid sleep_on race 2014-01-07 17:05:21 -08:00
synclinkmp.c tty: synclink: avoid sleep_on race 2014-01-07 17:05:21 -08:00
sysrq.c sysrq: Allow magic SysRq key functions to be disabled through Kconfig 2013-10-16 13:01:44 -07:00
tty_audit.c audit: convert all sessionid declaration to unsigned int 2014-01-13 22:31:46 -05:00
tty_buffer.c Staging: speakup: Update __speakup_paste_selection() tty (ab)usage to match vt 2014-06-11 11:54:12 -07:00
tty_io.c tty: Fix high cpu load if tty is unreleaseable 2014-11-14 09:00:10 -08:00
tty_ioctl.c tty: Fix SIGTTOU not sent with tcflush() 2013-09-25 17:52:17 -07:00
tty_ldisc.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00
tty_ldsem.c tty: Fix hang at ldsem_down_read() 2013-12-16 16:55:43 -08:00
tty_mutex.c
tty_port.c tty: delete non-required instances of include <linux/init.h> 2014-01-07 17:05:21 -08:00