1
0
Fork 0
alistair23-linux/drivers
Shardar Shariff Md 853a699739 serial: tegra: handle race condition on uart rx side
The tegra serial driver has two paths through which receive data is
copied up to the tty layer. These are:
1. DMA completion callback
2. UART RX interrupt

A UART RX interrupt occurs for either RX_TIMEOUT (data has been sitting
in the Rx FIFO for more than 4 character times without being read
because there is not enough data to reach the trigger level), End of
Receive Data event (receiver detects that data stops coming in for more
than 4 character times) or a receive error.

In the RX interrupt path, the following happens ...
- All RX DMA transfers are stopped
- Any data in the DMA buffer and RX FIFO are copied up to the tty layer.
- DMA is restarted/primed for the RX path

In the DMA completion callback, the DMA buffer is copied up to the tty
layer but there is no check to see if the RX interrupt could have
occurred between the DMA interrupt firing the the DMA callback running.
Hence, if a RX interrupt was to occur shortly after the DMA completion
interrupt, it is possible that the RX interrupt path has already copied
the DMA buffer before the DMA callback has been called. Therefore, when
the DMA callback is called, if the DMA is already in-progress, then this
indicates that the UART RX interrupt has already occurred and there is
nothing to do in the DMA callback. This race condition can cause
duplicated data to be received.

Signed-off-by: Shardar Shariff Md <smohammed@nvidia.com>
[jonathanh@nvidia.com: Moved async_tx_ack() call to after check to see
 if DMA has completed because if the DMA is in progress we do not need
 to ACK yet. Changed the print from dev_info to dev_debug. Updated
 changelog to add more commentary on the race condition based upon
 feedback from author.]
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-10 19:12:19 +02:00
..
accessibility
acpi ACPI / SBS: Enable battery manager when present 2015-04-29 00:04:29 +02:00
amba
android
ata powerpc updates for 4.1 2015-04-16 13:53:32 -05:00
atm
auxdisplay
base Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
bcma Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-04-17 15:50:54 -04:00
block rbd: end I/O the entire obj_request on error 2015-05-01 16:44:30 -07:00
bluetooth Bluetooth: btusb: Use proper data structures for Intel vendor events 2015-04-09 10:42:18 +03:00
bus ARM: SoC driver updates for v4.1 2015-04-22 09:18:17 -07:00
cdrom
char Char/Misc driver patches for 4.1-rc1 2015-04-21 09:42:58 -07:00
clk ARM: SoC multiplatform code changes for v4.1 2015-04-22 09:20:15 -07:00
clocksource Initial ACPI support for arm64: 2015-04-24 08:23:45 -07:00
connector
cpufreq cpufreq: intel_pstate: Fix an annoying !CONFIG_SMP warning 2015-04-15 23:02:24 +02:00
cpuidle cpuidle: Run tick_broadcast_exit() with disabled interrupts 2015-04-29 15:19:21 +02:00
crypto Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2015-04-26 13:51:05 -07:00
dca
devfreq
dio
dma dmaenegine: edma: allow pause/resume for non-cyclic mode 2015-05-06 22:27:01 +02:00
dma-buf dma-buf: cleanup dma_buf_export() to make it easily extensible 2015-04-21 14:47:16 +05:30
edac
eisa
extcon Char/Misc driver patches for 4.1-rc1 2015-04-21 09:42:58 -07:00
firewire
firmware ARM: SoC driver updates for v4.1 2015-04-22 09:18:17 -07:00
fmc
gpio ARM: SoC cleanups for v4.1 2015-04-22 09:04:39 -07:00
gpu Merge tag 'drm-intel-fixes-2015-04-30' of git://anongit.freedesktop.org/drm-intel into drm-fixes 2015-05-04 08:56:47 +10:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2015-04-14 18:25:15 -07:00
hsi HSI: cmt_speech: fix error return code 2015-04-05 14:45:27 +02:00
hv Drivers: hv: hv_balloon: correctly handle num_pages>INT_MAX case 2015-04-03 16:20:12 +02:00
hwmon hwmon: (w83795) use find_closest_descending() in pwm_freq_to_reg() 2015-04-17 09:03:55 -04:00
hwspinlock
hwtracing/coresight Char/Misc driver patches for 4.1-rc1 2015-04-21 09:42:58 -07:00
i2c Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2015-04-26 17:44:09 -07:00
ide ide: remove deprecated use of pci api 2015-04-17 15:32:07 -04:00
idle Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
iio Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2015-04-14 09:50:27 -07:00
infiniband Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
input tty: remove buf parameter from tty_name() 2015-05-06 22:26:57 +02:00
iommu Merge git://git.infradead.org/intel-iommu 2015-04-26 17:47:46 -07:00
ipack
irqchip Initial ACPI support for arm64: 2015-04-24 08:23:45 -07:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2015-04-15 09:00:47 -07:00
leds This is the bulk of GPIO changes for the v4.1 development 2015-04-18 08:22:10 -04:00
lguest Some virtio internal cleanups, a new virtio device "virtio input", and 2015-04-22 10:55:06 -07:00
macintosh Merge branch 'next-remove-ldst' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc into next 2015-04-07 13:25:14 +10:00
mailbox
mcb mcb: request_mem_region() returns NULL on error 2015-04-03 16:15:30 +02:00
md dm: fix free_rq_clone() NULL pointer when requeueing unmapped request 2015-04-30 10:25:21 -04:00
media v4l: xilinx: fix for include file movement 2015-04-26 09:56:08 -07:00
memory ARM: SoC driver updates for v4.1 2015-04-22 09:18:17 -07:00
memstick memstick: mspro_block: add missing curly braces 2015-04-17 09:04:09 -04:00
message
mfd platform/chrome: Updates for v4.1 2015-04-26 13:36:02 -07:00
misc Char/Misc driver patches for 4.1-rc1 2015-04-21 09:42:58 -07:00
mmc Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
mtd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
net net: fec: Fix RGMII-ID mode 2015-04-30 16:48:53 -04:00
nfc NFC: logging neatening 2015-04-07 12:05:12 +02:00
ntb
nubus
of Devicetree updates for 4.1: 2015-04-24 08:46:18 -07:00
oprofile Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
parisc parisc: Eliminate sg_virt_addr() and private scatterlist.h 2015-04-21 22:02:43 +02:00
parport
pci xen: features and fixes for 4.1-rc0 2015-04-16 14:01:03 -05:00
pcmcia ARM: SoC cleanups for v4.1 2015-04-22 09:04:39 -07:00
phy USB patches for 4.1-rc1 2015-04-13 17:07:21 -07:00
pinctrl pinctrl: fix allmodconfig noise 2015-04-15 10:02:42 +02:00
platform platform-drivers-x86 for 4.1 2015-04-26 13:44:46 -07:00
pnp Power management and ACPI updates for v4.1-rc1 2015-04-14 20:21:54 -07:00
power power: twl4030_madc_battery: Add missing MODULE_ALIAS 2015-04-06 19:39:57 +02:00
powercap powercap / RAPL: Add support for Intel Skylake processors 2015-04-15 23:06:16 +02:00
pps
ps3
ptp
pwm pwm: Remove __init initializer for pwm_add_table() 2015-04-23 14:50:52 +02:00
rapidio
ras
regulator == Changes to existing drivers == 2015-04-14 17:29:55 -07:00
remoteproc
reset
rpmsg
rtc drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic 2015-04-17 09:04:12 -04:00
s390 s390/3215: free memory in error path 2015-04-23 16:55:50 +02:00
sbus drivers/sbus/char/envctrl.c: ignore orderly_poweroff return value 2015-04-15 16:35:23 -07:00
scsi 3w-9xxx: fix command completion race 2015-04-27 10:10:19 -07:00
sfi
sh drivers: sh: Remove test for now unsupported sh7372 2015-04-27 13:08:14 +09:00
sn
soc - fix unused variable warning for pmic-wrapper 2015-04-14 00:43:28 +02:00
spi Merge branch 'for-linus' of git://git.infradead.org/users/vkoul/slave-dma 2015-04-24 09:49:37 -07:00
spmi spmi: pmic_arb: remove ARM build time dependency 2015-04-03 16:15:30 +02:00
ssb Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-04-17 15:50:54 -04:00
staging Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2015-04-26 17:22:07 -07:00
target Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-04-24 10:22:09 -07:00
tc
thermal drivers: thermal: st: remove several sparse warnings 2015-04-07 13:43:28 -07:00
thunderbolt
tty serial: tegra: handle race condition on uart rx side 2015-05-10 19:12:19 +02:00
uio Revert "uio: constify of_device_id array" 2015-04-03 16:04:21 +02:00
usb cdc-acm: prevent infinite loop when parsing CDC headers. 2015-04-28 12:53:16 +02:00
uwb
vfio vfio-pci: Fix use after free 2015-04-08 08:11:51 -06:00
vhost Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-04-24 10:22:09 -07:00
video fbdev changes for v4.1 2015-04-20 15:16:25 -07:00
virt
virtio virtio: drop virtio_device_is_legacy_only 2015-04-15 12:41:14 +09:30
vlynq
vme
w1
watchdog Merge git://www.linux-watchdog.org/linux-watchdog 2015-04-22 11:22:55 -07:00
xen Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending 2015-04-24 10:22:09 -07:00
zorro
Kconfig
Makefile coresight: moving to new "hwtracing" directory 2015-04-03 16:17:04 +02:00