]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
serial: 8250: 8250_omap: Fix race b/w dma completion and RX timeout
authorVignesh R <vigneshr@ti.com>
Tue, 20 Jun 2017 05:42:12 +0000 (11:12 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Jun 2017 15:03:10 +0000 (17:03 +0200)
commita1bfb6eb300d008decfbcdf13b0fda536d22dea9
tree560e8df7ad448efe1477342ae9b37b71264a98c5
parentcfde770d945f63b8d66eef0246209cea985f0913
serial: 8250: 8250_omap: Fix race b/w dma completion and RX timeout

DMA RX completion handler for UART is called from a tasklet and hence
may be delayed depending on the system load. In meanwhile, there may be
RX timeout interrupt which can get serviced first before DMA RX
completion handler is executed for the completed transfer.
omap_8250_rx_dma_flush() which is called on RX timeout interrupt makes
sure that the DMA RX buffer is pushed and then the FIFO is drained and
also queues a new DMA request. But, when DMA RX completion handler
executes, it will erroneously flush the currently queued DMA transfer
which sometimes results in data corruption and double queueing of DMA RX
requests.

Fix this by checking whether RX completion is for the currently queued
transfer or not. And also hold port lock when in DMA completion to avoid
race wrt RX timeout handler preempting it.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_omap.c