linux-stable/drivers/tty
Christian Riesch 8bfbe2de76 n_tty: Fix read_buf race condition, increment read_head after pushing data
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-11-26 19:35:48 -08:00
..
hvc tty: hvcs: Remove unnecessary KERN_ERR in hvcs.c 2014-11-05 19:24:07 -08:00
ipwireless tty: ipwireless: Fix probable mask then right shift defects 2014-11-05 20:06:33 -08:00
serial serial: of-serial: add PM suspend/resume support 2014-11-25 17:06:40 -08:00
vt tty: pr_warning->pr_warn and logging neatening 2014-11-25 17:06:38 -08:00
amiserial.c tty/amiserial: avoid interruptible_sleep_on 2014-01-07 17:05:21 -08:00
bfin_jtag_comm.c sched, cleanup, treewide: Remove set_current_state(TASK_RUNNING) after schedule() 2014-09-19 12:35:17 +02:00
cyclades.c tty: Remove tty_hung_up_p() tests from tty drivers' open() 2014-07-10 16:06:49 -07:00
ehv_bytechan.c tty: pr_warning->pr_warn and logging neatening 2014-11-25 17:06:38 -08:00
goldfish.c goldfish: off by one in goldfish_tty_console_setup() 2014-11-05 16:12:45 -08:00
isicom.c tty: pr_warning->pr_warn and logging neatening 2014-11-25 17:06:38 -08:00
Kconfig drivers/tty: ehv_bytechan fails to build as a module 2014-01-09 17:52:12 -06:00
Makefile
metag_da.c tty/metag_da: Add console_poll module parameter 2014-09-28 21:35:56 -04:00
moxa.c TTY: fix decimal printf format specifiers prefixed with 0x 2014-09-08 15:51:35 -07:00
moxa.h
mxser.c
mxser.h
n_gsm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2014-08-06 09:38:14 -07:00
n_hdlc.c drivers/tty/n_hdlc.c: replace kmalloc/memset by kzalloc 2014-05-28 13:33:18 -07:00
n_r3964.c
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 2014-11-26 19:35:48 -08:00
nozomi.c drivers/tty/nozomi.c: Use 'nozomi_setup_memory' instead of 'setup_memory' 2014-09-08 16:09:23 -07:00
pty.c pty, n_tty: Simplify input processing on final close 2014-11-05 18:50:42 -08:00
rocket.c
rocket.h
rocket_int.h
synclink.c tty: Remove tty_hung_up_p() tests from tty drivers' open() 2014-07-10 16:06:49 -07:00
synclink_gt.c synclink_gt: use pci_zalloc_consistent 2014-08-08 15:57:30 -07:00
synclinkmp.c tty: Remove tty_hung_up_p() tests from tty drivers' open() 2014-07-10 16:06:49 -07:00
sysrq.c mm, oom: ensure memoryless node zonelist always includes zones 2014-08-06 18:01:21 -07:00
tty_audit.c audit: anchor all pid references in the initial pid namespace 2014-03-20 10:11:55 -04:00
tty_buffer.c tty: Flush ldisc buffer atomically with tty flip buffers 2014-11-05 18:50:43 -08:00
tty_io.c tty: warn on deprecated serial flags 2014-11-06 15:01:03 -08:00
tty_ioctl.c tty: Call methods in modern style 2014-11-05 20:18:30 -08:00
tty_ldisc.c tty: Allow safe access to termios for set_ldisc() handlers 2014-11-06 14:57:27 -08:00
tty_ldsem.c lockdep: Make held_lock->check and "int check" argument bool 2014-02-09 21:18:54 +01:00
tty_mutex.c tty: Preset lock subclass for nested tty locks 2014-11-05 18:50:42 -08:00
tty_port.c tty: Flush tty buffers after hardware shutdown 2014-11-06 14:57:27 -08:00