linux_dsm_epyc7002/drivers
Nguyen Dinh Phi c2e390c4df tty: Fix data race between tiocsti() and flush_to_ldisc()
commit bb2853a6a421a052268eee00fd5d3f6b3504b2b1 upstream.

The ops->receive_buf() may be accessed concurrently from these two
functions.  If the driver flushes data to the line discipline
receive_buf() method while tiocsti() is waiting for the
ops->receive_buf() to finish its work, the data race will happen.

For example:
tty_ioctl			|tty_ldisc_receive_buf
 ->tioctsi			| ->tty_port_default_receive_buf
				|  ->tty_ldisc_receive_buf
   ->hci_uart_tty_receive	|   ->hci_uart_tty_receive
    ->h4_recv                   |    ->h4_recv

In this case, the h4 receive buffer will be overwritten by the
latecomer, and we will lost the data.

Hence, change tioctsi() function to use the exclusive lock interface
from tty_buffer to avoid the data race.

Reported-by: syzbot+97388eb9d31b997fe1d0@syzkaller.appspotmail.com
Reviewed-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Link: https://lore.kernel.org/r/20210823000641.2082292-1-phind.uet@gmail.com
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-05 19:13:40 +02:00
..
accessibility
acpi ACPI: NFIT: Fix support for virtual SPA ranges 2024-07-05 18:54:10 +02:00
amba
android init: add dsm gpl source 2024-07-05 18:00:04 +02:00
ata libata: fix ata_host_start() 2024-07-05 19:09:43 +02:00
atm
auxdisplay
base driver core: Fix error return code in really_probe() 2024-07-05 19:10:52 +02:00
bcma bcma: Fix memory leak for internally-handled cores 2024-07-05 19:13:05 +02:00
block block: nbd: add sanity check for first_minor 2024-07-05 19:10:20 +02:00
bluetooth Bluetooth: btusb: check conditions before enabling USB ALT 3 for WBS 2024-07-05 19:01:00 +02:00
bus bus: ti-sysc: Fix error handling for sysc_check_active_timer() 2024-07-05 18:55:45 +02:00
cdrom
char tpm: ibmvtpm: Avoid error message when process gets signal while waiting 2024-07-05 19:10:21 +02:00
clk clk: renesas: rcar-usb2-clock-sel: Fix kernel NULL pointer dereference 2024-07-05 19:00:49 +02:00
clocksource clocksource/drivers/sh_cmt: Fix wrong setting if don't request IRQ for clock source channel 2024-07-05 19:10:20 +02:00
connector
counter counter: 104-quad-8: Return error when invalid mode during ceiling_write 2024-07-05 19:11:38 +02:00
cpufreq cpufreq: blocklist Qualcomm sm8150 in cpufreq-dt-platdev 2024-07-05 19:00:49 +02:00
cpuidle
crypto crypto: qat - use proper type for vf_mask 2024-07-05 19:10:20 +02:00
dax
dca
devfreq
dio
dma dmaengine: of-dma: router_xlate to return -EPROBE_DEFER if controller is not yet available 2024-07-05 18:55:31 +02:00
dma-buf init: add dsm gpl source 2024-07-05 18:00:04 +02:00
edac EDAC/i10nm: Fix NVDIMM detection 2024-07-05 19:10:30 +02:00
eisa
extcon
firewire
firmware firmware: raspberrypi: Fix a leak in 'rpi_firmware_get()' 2024-07-05 19:12:05 +02:00
fpga fpga: dfl: fme: Fix cpu hotplug issue in performance reporting 2024-07-05 18:52:30 +02:00
fsi fsi: Add missing MODULE_DEVICE_TABLE 2021-07-20 16:05:42 +02:00
gnss
gpio Revert "gpio: mpc8xxx: change the gpio interrupt flags." 2024-07-05 18:52:30 +02:00
gpu drm/msm/dsi: Fix some reference counted resource leaks 2024-07-05 19:11:46 +02:00
greybus
hid HID: wacom: Re-enable touch by default for Cintiq 24HDT / 27QHDT 2024-07-05 18:03:16 +02:00
hsi
hv
hwmon init: add dsm gpl source 2024-07-05 18:00:04 +02:00
hwspinlock
hwtracing intel_th: Wait until port is in reset before programming it 2021-07-20 16:05:46 +02:00
i2c i2c: xlp9xx: fix main IRQ check 2024-07-05 19:12:31 +02:00
i3c
ide ide/falconide: Fix module unload 2021-03-04 11:38:21 +01:00
idle
iio iio: adc: Fix incorrect exit of for-loop 2024-07-05 18:53:59 +02:00
infiniband RDMA/efa: Free IRQ vectors on error flow 2024-07-05 18:57:45 +02:00
input Input: hideep - fix the uninitialized use in hideep_nvm_unlock() 2021-07-20 16:05:44 +02:00
interconnect interconnect: qcom: icc-rpmh: Ensure floor BW is enforced for all nodes 2024-07-05 18:52:31 +02:00
iommu iommu/vt-d: Fix incomplete cache flush in intel_pasid_tear_down_entry() 2024-07-05 18:55:47 +02:00
ipack ipack: tpci200: fix memory leak in the tpci200_register 2024-07-05 18:55:59 +02:00
irqchip irqchip/gic-v3: Fix priority comparison when non-secure priorities are used 2024-07-05 19:10:20 +02:00
isdn
leds leds: trigger: audio: Add an activate callback to ensure the initial brightness is set 2024-07-05 19:11:28 +02:00
lightnvm
macintosh
mailbox
mcb
md bcache: add proper error unwinding in bcache_device_init 2024-07-05 19:09:34 +02:00
media media: venus: venc: Fix potential null pointer dereference on pointer fmt 2024-07-05 19:11:28 +02:00
memory memory: tegra: Fix compilation warnings on 64bit platforms 2021-07-25 14:36:14 +02:00
memstick
message
mfd init: add dsm gpl source 2024-07-05 18:00:04 +02:00
misc lkdtm: replace SCSI_DISPATCH_CMD with SCSI_QUEUE_RQ 2024-07-05 19:12:05 +02:00
mmc mmc: moxart: Fix issue with uninitialized dma_slave_config 2024-07-05 19:12:23 +02:00
most
mtd mtd: spinand: Fix incorrect parameters for on-die ECC 2024-07-05 19:00:51 +02:00
mux
net iwlwifi Add support for ax201 in Samsung Galaxy Book Flex2 Alpha 2024-07-05 19:13:39 +02:00
nfc nfc: nfcsim: fix use after free during module unload 2024-07-05 18:03:16 +02:00
ntb init: add dsm gpl source 2024-07-05 18:00:04 +02:00
nubus
nvdimm libnvdimm/region: Fix label activation vs errors 2024-07-05 18:54:10 +02:00
nvme nvmet: pass back cntlid on successful completion 2024-07-05 19:09:35 +02:00
nvmem init: add dsm gpl source 2024-07-05 18:00:04 +02:00
of init: add dsm gpl source 2024-07-05 18:00:04 +02:00
opp opp: remove WARN when no valid OPPs remain 2024-07-05 19:00:49 +02:00
oprofile
parisc
parport
pci PCI: PM: Enable PME if it can be signaled from D3cold 2024-07-05 19:11:28 +02:00
pcmcia pcmcia: i82092: fix a null pointer dereference bug 2024-07-05 18:52:30 +02:00
perf
phy init: add dsm gpl source 2024-07-05 18:00:04 +02:00
pinctrl pinctrl: tigerlake: Fix GPIO mapping for newer version of software 2024-07-05 18:54:11 +02:00
platform platform/x86: pcengines-apuv2: Add missing terminating entries to gpio-lookup tables 2024-07-05 18:54:12 +02:00
pnp
power power: supply: cw2015: use dev_err_probe to allow deferred probe 2024-07-05 19:09:52 +02:00
powercap
pps
ps3
ptp ptp_pch: Restore dependency on PCI 2024-07-05 18:55:46 +02:00
pwm init: add dsm gpl source 2024-07-05 18:00:04 +02:00
rapidio
ras
regulator regulator: vctrl: Avoid lockdep warning in enable/disable ops 2024-07-05 19:10:30 +02:00
remoteproc remoteproc: k3-r5: Fix an error message 2021-07-20 16:05:50 +02:00
reset reset: reset-zynqmp: Fixed the argument data type 2024-07-05 19:04:37 +02:00
rpmsg
rtc init: add dsm gpl source 2024-07-05 18:00:04 +02:00
s390 s390/ap: fix state machine hang after failure to enable irq 2024-07-05 19:09:52 +02:00
sbus
scsi scsi: core: Fix hang of freezing queue between blocking and running device 2024-07-05 18:57:30 +02:00
sfi
sh
siox
slimbus slimbus: ngd: reset dma setup during runtime pm 2024-07-05 18:55:58 +02:00
soc soc: qcom: smsm: Fix missed interrupts if state changes while masked 2024-07-05 19:11:28 +02:00
soundwire
spi spi: spi-zynq-qspi: use wait_for_completion_timeout to make zynq_qspi_exec_mem_op not interruptible 2024-07-05 19:10:30 +02:00
spmi
ssb
staging clk: staging: correct reference to config IOMEM to config HAS_IOMEM 2024-07-05 19:12:04 +02:00
syno init: add dsm gpl source 2024-07-05 18:00:04 +02:00
target scsi: target: Fix protect handling in WRITE SAME(32) 2021-07-28 14:35:39 +02:00
tc
tee tee: Correct inappropriate usage of TEE_SHM_DMA_BUF flag 2024-07-05 18:53:10 +02:00
thermal init: add dsm gpl source 2024-07-05 18:00:04 +02:00
thunderbolt
tty tty: Fix data race between tiocsti() and flush_to_ldisc() 2024-07-05 19:13:40 +02:00
uio
usb usb: bdc: Fix a resource leak in the error handling path of 'bdc_probe()' 2024-07-05 19:12:32 +02:00
vdpa vdpa/mlx5: Avoid destroying MR on empty iotlb 2024-07-05 18:55:45 +02:00
vfio
vhost vringh: Use wiov->used to check for read/write desc order 2024-07-05 19:00:50 +02:00
video backlight: lm3630a: Fix return code of .update_status() callback 2021-07-20 16:05:45 +02:00
virt
virtio virtio_vdpa: reject invalid vq indices 2024-07-05 19:00:50 +02:00
visorbus
vlynq
vme
w1
watchdog Revert "watchdog: iTCO_wdt: Account for rebooting on second timeout" 2024-07-05 18:07:51 +02:00
xen xen/events: Fix race in set_evtchn_to_irq 2024-07-05 18:54:39 +02:00
zorro
Kconfig init: add dsm gpl source 2024-07-05 18:00:04 +02:00
Makefile init: add dsm gpl source 2024-07-05 18:00:04 +02:00