From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761282AbbA3XZO (ORCPT ); Fri, 30 Jan 2015 18:25:14 -0500 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:38372 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753323AbbA3XZL (ORCPT ); Fri, 30 Jan 2015 18:25:11 -0500 X-Sasl-enc: nDYHzSE7Qfb7DN6LWtILsOjxjmiCYOuNWiRwaZsavLGq 1422660310 Date: Fri, 30 Jan 2015 15:25:09 -0800 From: Greg KH To: Michael Doswald Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] 3.19-rc4: Fix race condition in i.MX serial port driver Message-ID: <20150130232509.GA21337@kroah.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 13, 2015 at 05:07:08PM +0100, Michael Doswald wrote: > Under pressure, the imx.c device driver may transfer the same data multiple > times. > > Reason: > Function imx_dma_tx checks for an active DMA transfer by calling > dmaengine_tx_status. The return value may indicate that no transfer is > running while the dma_tx_callback function is still being executed. In > this case the xmit->tail pointer may not be updated to the correct value > when imx_dma_tx initiates a new DMA transfer, which will result in a DMA > transfer with the same base address as the previous one. > > Patch: > Use existing dma_is_txing variable to guard DMA transfer initiation instead > of dmaengine_tx_status. Clear dma_is_txing at the end of the DMA callback > function therefore extending the critical section where the port lock is > held. Critical section extension is in line with the callback function > of other drivers, e.g. serial-tegra.c (tegra_uart_tx_dma_complete). > > > Signed-off-by: Michael Doswald > --- > drivers/tty/serial/imx.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) Fails to apply to my tree :(