From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932072AbbJTJqo (ORCPT ); Tue, 20 Oct 2015 05:46:44 -0400 Received: from smtp-out-200.synserver.de ([212.40.185.200]:1107 "EHLO smtp-out-188.synserver.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752824AbbJTJql (ORCPT ); Tue, 20 Oct 2015 05:46:41 -0400 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 2410 From: Lars-Peter Clausen To: Vinod Koul , Takashi Iwai Cc: Dan Williams , Russell King , Laurent Pinchart , Kuninori Morimoto , Qiao Zhou , Shengjiu Wang , Matt Campbell , Jonah Petri , dmaengine@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH 0/4] dmaengine: Add transfer termination synchronization support Date: Tue, 20 Oct 2015 11:46:27 +0200 Message-Id: <1445334391-12272-1-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The DMAengine API has a long standing issue that is inherent to the API itself. For a client that calls dmaengine_terminate_all() it is not possible to properly synchronize the completion of any currently running complete callbacks to the current context. This means it is possible to end up with a use-after-free race condition if client frees resources that are accessed in a complete callback before the complete callback has finished running. This patch series introduces a new explicit synchronization primitive to the DMAengine API which allows clients to ensure that all complete callbacks have finished running. This allows them to safely free any resources that might be accessed in a complete callback. The series for now only implements synchronization support for a single driver and only updates single client to make use of the new API. If there is agreement on the general approach more will follow. - Lars Lars-Peter Clausen (4): dmaengine: Add transfer termination synchronization support dmaengine: virt-dma: Add synchronization helper function dmaengine: axi_dmac: Add synchronization support ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Documentation/dmaengine/client.txt | 38 ++++++++++++++- Documentation/dmaengine/provider.txt | 20 +++++++- drivers/dma/dma-axi-dmac.c | 8 ++++ drivers/dma/dmaengine.c | 5 +- drivers/dma/virt-dma.h | 13 ++++++ include/linux/dmaengine.h | 90 ++++++++++++++++++++++++++++++++++++ sound/core/pcm_dmaengine.c | 9 ++-- 7 files changed, 175 insertions(+), 8 deletions(-) -- 2.1.4