From patchwork Fri Apr 18 00:56:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 4012331 X-Patchwork-Delegate: vinod.koul@intel.com Return-Path: X-Original-To: patchwork-dmaengine@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8A684BFF02 for ; Fri, 18 Apr 2014 00:57:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C695F202FF for ; Fri, 18 Apr 2014 00:57:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 00BFB202EB for ; Fri, 18 Apr 2014 00:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751356AbaDRA5R (ORCPT ); Thu, 17 Apr 2014 20:57:17 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:52585 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751274AbaDRA5Q (ORCPT ); Thu, 17 Apr 2014 20:57:16 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3I0v9qI006333; Thu, 17 Apr 2014 19:57:09 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3I0v8ch016381; Thu, 17 Apr 2014 19:57:08 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 17 Apr 2014 19:57:08 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3I0v8eA027904; Thu, 17 Apr 2014 19:57:08 -0500 Received: from joel-laptop.itg.ti.com (j-172-22-150-32.vpn.ti.com [172.22.150.32]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s3I0v8t04645; Thu, 17 Apr 2014 19:57:08 -0500 (CDT) From: Joel Fernandes To: , , , CC: Joel Fernandes , Vinod Koul , Dan Williams , Russell King Subject: [PATCH] [FIX] dmaengine: virt-dma: Free descriptor after callback Date: Thu, 17 Apr 2014 19:56:50 -0500 Message-ID: <1397782610-7370-1-git-send-email-joelf@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 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, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Free the vd (virt descriptor) after the callback is called. In EDMA driver atleast which uses virt-dma, we make use of the desc during the callback and if its dangerously freed before the callback is called. I also noticed this in omap-dma dmaengine driver. Cc: Vinod Koul Cc: Dan Williams Cc: Russell King Signed-off-by: Joel Fernandes --- drivers/dma/virt-dma.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/virt-dma.c b/drivers/dma/virt-dma.c index 6f80432..98aeb7f 100644 --- a/drivers/dma/virt-dma.c +++ b/drivers/dma/virt-dma.c @@ -84,10 +84,10 @@ static void vchan_complete(unsigned long arg) list_del(&vd->node); - vc->desc_free(vd); - if (cb) cb(cb_data); + + vc->desc_free(vd); } }