From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751602AbcFCD7X (ORCPT ); Thu, 2 Jun 2016 23:59:23 -0400 Received: from mail-pa0-f66.google.com ([209.85.220.66]:34337 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750910AbcFCD7U (ORCPT ); Thu, 2 Jun 2016 23:59:20 -0400 Subject: Re: [PATCH] tty: serial: msm: Don't read off end of tx fifo To: Bjorn Andersson , Andy Gross , David Brown , Greg Kroah-Hartman , Jiri Slaby References: <1464914908-19059-1-git-send-email-bjorn.andersson@linaro.org> Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Nicolas Dechesne , Ivan Ivanov , Stephen Boyd , stable@vger.kernel.org From: Frank Rowand Message-ID: <57510093.5000702@gmail.com> Date: Thu, 2 Jun 2016 20:59:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <1464914908-19059-1-git-send-email-bjorn.andersson@linaro.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/02/16 17:48, Bjorn Andersson wrote: > 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 > Cc: Ivan Ivanov > Cc: Stephen Boyd > Cc: stable@vger.kernel.org > Reported-by: Frank Rowand > Reported-by: Nicolas Dechesne > Signed-off-by: Bjorn Andersson > --- > 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 */ > Thanks Bjorn. This eliminates my symptoms on 4.6 and 4.7-rc1. Tested-by: Frank Rowand -Frank