linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>
To: "vkoul@kernel.org" <vkoul@kernel.org>,
	"peter.ujfalusi@ti.com" <peter.ujfalusi@ti.com>
Cc: "dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
	"s.hauer@pengutronix.de" <s.hauer@pengutronix.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dmaengine: virt-dma: Fix access after free in vcna_complete()
Date: Fri, 20 Dec 2019 14:01:36 +0000	[thread overview]
Message-ID: <0303ceda023121d9048d2508e28c0306b1871561.camel@analog.com> (raw)
In-Reply-To: <20191220131100.21804-1-peter.ujfalusi@ti.com>

On Fri, 2019-12-20 at 15:11 +0200, Peter Ujfalusi wrote:
> [External]
> 
> vchan_vdesc_fini() is freeing up 'vd' so the access to vd->tx_result is
> via already freed up memory.
> 
> Move the vchan_vdesc_fini() after invoking the callback to avoid this.
> 

Apologies for seeing this too late: typo in title vcna_complete() ->
vchan_complete()


> Fixes: 09d5b702b0f97 ("dmaengine: virt-dma: store result on dma
> descriptor")
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
>  drivers/dma/virt-dma.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/virt-dma.c b/drivers/dma/virt-dma.c
> index ec4adf4260a0..256fc662c500 100644
> --- a/drivers/dma/virt-dma.c
> +++ b/drivers/dma/virt-dma.c
> @@ -104,9 +104,8 @@ static void vchan_complete(unsigned long arg)
>  		dmaengine_desc_get_callback(&vd->tx, &cb);
>  
>  		list_del(&vd->node);
> -		vchan_vdesc_fini(vd);
> -
>  		dmaengine_desc_callback_invoke(&cb, &vd->tx_result);
> +		vchan_vdesc_fini(vd);
>  	}
>  }
>  

  parent reply	other threads:[~2019-12-20 14:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20 13:11 [PATCH] dmaengine: virt-dma: Fix access after free in vcna_complete() Peter Ujfalusi
2019-12-20 13:56 ` Ardelean, Alexandru
2019-12-20 14:01 ` Ardelean, Alexandru [this message]
2019-12-20 14:50   ` Peter Ujfalusi
2019-12-23  7:54     ` Vinod Koul
2019-12-23  7:52 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0303ceda023121d9048d2508e28c0306b1871561.camel@analog.com \
    --to=alexandru.ardelean@analog.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).