Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751868AbdFTHE0 (ORCPT + 2 others); Tue, 20 Jun 2017 03:04:26 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34504 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750951AbdFTHEZ (ORCPT ); Tue, 20 Jun 2017 03:04:25 -0400 MIME-Version: 1.0 In-Reply-To: <1497897167-14556-220-git-send-email-w@1wt.eu> References: <1497897167-14556-1-git-send-email-w@1wt.eu> <1497897167-14556-220-git-send-email-w@1wt.eu> From: Richard Genoud Date: Tue, 20 Jun 2017 09:04:03 +0200 Message-ID: Subject: Re: [PATCH 3.10 219/268] tty/serial: atmel: fix race condition (TX+DMA) To: Willy Tarreau Cc: "linux-kernel@vger.kernel.org" , "#4 . 4+" , linux@roeck-us.net, Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Hi Willy, You can drop this patch. There's nothing to fix on 3.10.x since the DMA TX support has been introduced in 3.12. Thanks ! 2017-06-19 20:31 GMT+02:00 Willy Tarreau : > From: Richard Genoud > > 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 > [rg] backport to 3.12 > Signed-off-by: Richard Genoud > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: Willy Tarreau > --- > 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 82127ac..41d1df5 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -1090,6 +1090,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 its length accordingly. > + */ > + sg_dma_len(&atmel_port->sg_tx) = 0; > } > > /* > -- > 2.8.0.rc2.1.gbe9624a >