linux/include
Gaurav Kohli 020a3b1024 UPSTREAM: tty: fix data race between tty_init_dev and flush of buf
There can be a race, if receive_buf call comes before
tty initialization completes in n_tty_open and tty->disc_data
may be NULL.

CPU0					CPU1
----					----
 000|n_tty_receive_buf_common()   	n_tty_open()
-001|n_tty_receive_buf2()		tty_ldisc_open.isra.3()
-002|tty_ldisc_receive_buf(inline)	tty_ldisc_setup()

Using ldisc semaphore lock in tty_init_dev till disc_data
initializes completely.

Reviewed-by: Alan Cox <alan@linux.intel.com>
Cc: stable <stable@vger.kernel.org>

Change-Id: I3ba3cbd7dcb867a110878c8d0c47e6b920edd0b9
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Gaurav Kohli <gkohli@codeaurora.org>
(cherry-picked from commit b027e2298b)
2018-07-10 14:46:01 +08:00
..
acpi UPSTREAM: device property: Avoid potential dereferences of invalid pointers 2017-08-30 14:50:28 +08:00
asm-generic LSK 18.06 v4.4-android 2018-07-06 20:12:54 +08:00
clocksource
crypto UPSTREAM: crypto: hash - add zero length message hash for shax and md5 2018-05-24 11:44:00 +08:00
drm drm/rockchip: add support mcu init screen 2018-07-06 15:56:04 +08:00
dt-bindings clk: rockchip: rk3308: Export clk id for i2s src clocks 2018-05-17 14:08:33 +08:00
keys
kvm
linux UPSTREAM: tty: fix data race between tty_init_dev and flush of buf 2018-07-10 14:46:01 +08:00
math-emu
media rk: add SPDX license identifier to files with no license 2018-01-31 20:56:06 +08:00
memory
misc
net LSK 18.06 v4.4-android 2018-07-06 20:12:54 +08:00
pcmcia
ras
rdma RDMA/ucma: Introduce safer rdma_addr_size() variants 2018-04-08 11:51:59 +02:00
rxrpc
scsi scsi: sg: disable SET_FORCE_LOW_DMA 2018-01-23 19:50:14 +01:00
soc soc: rockchip: opp_select: Implement APIs for wide-temperature control 2018-07-06 19:38:51 +08:00
sound ASoC: rockchip: vad: optimize vad process 2018-06-08 14:38:07 +08:00
target target: Avoid early CMD_T_PRE_EXECUTE failures during ABORT_TASK 2018-01-17 09:35:31 +01:00
trace LSK 18.06 v4.4-android 2018-07-06 20:12:54 +08:00
uapi LSK 18.06 v4.4-android 2018-07-06 20:12:54 +08:00
video
xen fix xen_swiotlb_dma_mmap prototype 2017-10-05 09:41:48 +02:00
Kbuild