linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: "Ardelean, Alexandru" <alexandru.Ardelean@analog.com>,
	"vkoul@kernel.org" <vkoul@kernel.org>
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 16:50:44 +0200	[thread overview]
Message-ID: <486093bc-b1bf-1727-0402-f07606fffd1e@ti.com> (raw)
In-Reply-To: <0303ceda023121d9048d2508e28c0306b1871561.camel@analog.com>



On 20/12/2019 16.01, Ardelean, Alexandru wrote:
> 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()

Yep, I also noticed after sending it, I hope Vinod is kind enough and
fix it up when applying ;)

- Péter

>> 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);
>>  	}
>>  }
>>  


Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

  reply	other threads:[~2019-12-20 14:50 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
2019-12-20 14:50   ` Peter Ujfalusi [this message]
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=486093bc-b1bf-1727-0402-f07606fffd1e@ti.com \
    --to=peter.ujfalusi@ti.com \
    --cc=alexandru.Ardelean@analog.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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).