Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1412659

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

From Bjorn Andersson <bjorn.andersson@linaro.org>
Newsgroups linux.kernel
Subject [PATCH] tty: serial: msm: Don't read off end of tx fifo
Date 2016-06-03 02:50 +0200
Message-ID <rFLtg-4E1-25@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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: 3a878c430fd6 ("tty: serial: msm: Add TX DMA support")
Cc: Andy Gross <andy.gross@linaro.org>
Cc: Ivan Ivanov <iivanov.xz@gmail.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>
Cc: stable@vger.kernel.org
Reported-by: Frank Rowand <frowand.list@gmail.com>
Reported-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---
 drivers/tty/serial/msm_serial.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index b7d80bd57db9..7d62610d9de5 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -726,7 +726,7 @@ static void msm_handle_tx(struct uart_port *port)
 		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_min = 1;	/* Always DMA */
-- 
2.5.0

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] tty: serial: msm: Don't read off end of tx fifo Bjorn Andersson <bjorn.andersson@linaro.org> - 2016-06-03 02:50 +0200
  Re: [PATCH] tty: serial: msm: Don't read off end of tx fifo Frank Rowand <frowand.list@gmail.com> - 2016-06-03 06:00 +0200
  Re: [PATCH] tty: serial: msm: Don't read off end of tx fifo Stephen Boyd <sboyd@codeaurora.org> - 2016-06-04 02:10 +0200
  Re: [PATCH] tty: serial: msm: Don't read off end of tx fifo Andy Gross <andy.gross@linaro.org> - 2016-06-05 20:50 +0200

csiph-web