From patchwork Sun Aug 3 17:13:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 4666121 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 282649F375 for ; Sun, 3 Aug 2014 17:13:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 543BC200E8 for ; Sun, 3 Aug 2014 17:13:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E395201BF for ; Sun, 3 Aug 2014 17:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752036AbaHCRNO (ORCPT ); Sun, 3 Aug 2014 13:13:14 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:53714 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751822AbaHCRNN (ORCPT ); Sun, 3 Aug 2014 13:13:13 -0400 Received: from axis700.grange (xdsl-85-197-61-212.netcologne.de [85.197.61.212]) by mrelayeu.kundenserver.de (node=mreue005) with ESMTP (Nemesis) id 0Lxbep-1WPA0a3chH-017GfN; Sun, 03 Aug 2014 19:13:04 +0200 Received: by axis700.grange (Postfix, from userid 1000) id 4D96E40BDB; Sun, 3 Aug 2014 19:13:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 4550040BD9; Sun, 3 Aug 2014 19:13:03 +0200 (CEST) Date: Sun, 3 Aug 2014 19:13:03 +0200 (CEST) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: dmaengine@vger.kernel.org cc: Vinod Koul , "Shevchenko, Andriy" , devicetree@vger.kernel.org, Grant Likely , Rob Herring , Phil Edworthy , Arnd Bergmann Subject: [PATCH 1/2] dmaengine: nbpfaxi: fix a theoretical race Message-ID: MIME-Version: 1.0 X-Provags-ID: V02:K0:mT2pZJeTHdMvJI/EILKB7LkM8Rfz4N1fypbSkLc8YEw JGY/gj5cZ8zsfToWwkisJcTNrXkN+CHTZ1afwx3QRzpfYz2xNT 3LwGZJ2CVlvfTgXjFekLVwS39o+VT8li+/UQmoN1iPsKbM5vXA DvC2RJT10CmXKC8J8XLtXbyRC42gzTXy3Qr1Y3qAPeVi1n5NgS ik2dT4DfKOyYqzpzFzHg5QWyyAnxU0I9cfNLLtFlzqiCO2DPvG oAc5jbmEYYc+ZNYTVbwet8l3kYzHDruLtpBpNLrQCTUZTWmW7D irf6z6+fULYxB+o5cag3yOyA+EJbQfvbikelGgGKajumLzLGro PDz7d2SI6W9QCFXwlpyicLYBTqslZXbNFj2HYQQTd1n1UzMZqA eMPO2RSIkwxPg== Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A race possibility exists if a DMA slave driver tries to free channel resources witout waiting for all transfers to complete and without explicitly terminating all requests. In such a case the IRQ processing thread can race with .device_free_chan_resources(). To fix this race empty all descriptor lists before freeing descriptor cache. Signed-off-by: Guennadi Liakhovetski --- drivers/dma/nbpfaxi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c index 77c5a89..5b40ac8 100644 --- a/drivers/dma/nbpfaxi.c +++ b/drivers/dma/nbpfaxi.c @@ -1054,6 +1054,7 @@ static void nbpf_free_chan_resources(struct dma_chan *dchan) dev_dbg(dchan->device->dev, "Entry %s()\n", __func__); nbpf_chan_halt(chan); + nbpf_chan_idle(chan); /* Clean up for if a channel is re-used for MEMCPY after slave DMA */ nbpf_chan_prepare_default(chan);