Commit 30acf549 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Greg Kroah-Hartman

tty: serial: msm: Don't read off end of tx fifo

For dm uarts in pio mode tx data is transferred to the fifo register 4
bytes at a time, but care is not taken when these 4 bytes spans the end
of the xmit buffer so the loop might read up to 3 bytes past the buffer
and then skip the actual data at the beginning of the buffer.

Fix this by, analogous to the DMA case, make sure the chunk doesn't
wrap the xmit buffer.

Fixes: 3a878c43 ("tty: serial: msm: Add TX DMA support")
Cc: Ivan Ivanov <iivanov.xz@gmail.com>
Cc: stable@vger.kernel.org
Reported-by: default avatarFrank Rowand <frowand.list@gmail.com>
Reported-by: default avatarNicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Acked-by: default avatarAndy Gross <andy.gross@linaro.org>
Tested-by: default avatarFrank Rowand <frank.rowand@am.sony.com>
Reviewed-by: default avatarStephen Boyd <sboyd@codeaurora.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 002eb41f
...@@ -891,7 +891,7 @@ static void msm_handle_tx(struct uart_port *port) ...@@ -891,7 +891,7 @@ static void msm_handle_tx(struct uart_port *port)
return; return;
} }
pio_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE); pio_count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
dma_count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); dma_count = CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE);
dma_min = 1; /* Always DMA */ dma_min = 1; /* Always DMA */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment