From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com ([209.85.128.193]:33758 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752752AbdDJPax (ORCPT ); Mon, 10 Apr 2017 11:30:53 -0400 Received: by mail-wr0-f193.google.com with SMTP id l28so4817471wre.0 for ; Mon, 10 Apr 2017 08:30:53 -0700 (PDT) Subject: Re: [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA) To: Richard Genoud , stable@vger.kernel.org References: <20170410125930.26495-1-jslaby@suse.cz> <20170410125930.26495-43-jslaby@suse.cz> <31c49511-39de-1a15-f0e8-ce65c6fd8725@gmail.com> From: Jiri Slaby Message-ID: <3306ba68-5935-0cdd-fa92-27cd68f27122@suse.cz> Date: Mon, 10 Apr 2017 17:30:50 +0200 MIME-Version: 1.0 In-Reply-To: <31c49511-39de-1a15-f0e8-ce65c6fd8725@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: stable-owner@vger.kernel.org List-ID: On 04/10/2017, 03:47 PM, Richard Genoud wrote: > On 10/04/2017 14:59, Jiri Slaby wrote: >> From: Richard Genoud >> >> This patch has been added to the 3.12 stable tree. If you have any >> objections, please let us know. >> >> =============== >> >> commit 31ca2c63fdc0aee725cbd4f207c1256f5deaabde upstream. >> >> If uart_flush_buffer() is called between atmel_tx_dma() and >> atmel_complete_tx_dma(), the circular buffer has been cleared, but not >> atmel_port->tx_len. >> That leads to a circular buffer overflow (dumping (UART_XMIT_SIZE - >> atmel_port->tx_len) bytes). >> >> Tested-by: Nicolas Ferre >> Signed-off-by: Richard Genoud >> Signed-off-by: Jiri Slaby >> --- >> drivers/tty/serial/atmel_serial.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c >> index ab2e22bf54fd..0e0023f7c18d 100644 >> --- a/drivers/tty/serial/atmel_serial.c >> +++ b/drivers/tty/serial/atmel_serial.c >> @@ -1690,6 +1690,11 @@ static void atmel_flush_buffer(struct uart_port *port) >> UART_PUT_TCR(port, 0); >> atmel_port->pdc_tx.ofs = 0; >> } >> + /* >> + * in uart_flush_buffer(), the xmit circular buffer has just >> + * been cleared, so we have to reset tx_len accordingly. >> + */ >> + atmel_port->tx_len = 0; >> } >> >> /* >> > Hi, > This won't compile on 3.12 kernel since ->tx_len doesn't exist yet. > > Here is the backported version of this patch: Ok, in the meantime I dropped it and now applied the backport. Thanks! -- js suse labs