DMA Engine development
 help / color / mirror / Atom feed
From: T Pratham <t-pratham@ti.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net>,
	Kamlesh Gurudasani <kamlesh@ti.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Praneeth Bajjuri <praneeth@ti.com>,
	Manorit Chawdhry <m-chawdhry@ti.com>,
	<linux-kernel@vger.kernel.org>, <linux-crypto@vger.kernel.org>,
	Vinod Koul <vkoul@kernel.org>, <dmaengine@vger.kernel.org>
Subject: Re: [PATCH v5 2/2] crypto: ti: Add driver for DTHE V2 AES Engine (ECB, CBC)
Date: Thu, 12 Jun 2025 15:45:54 +0530	[thread overview]
Message-ID: <b27eab62-cfe0-4dfc-8429-ea464eef9e6f@ti.com> (raw)
In-Reply-To: <aElSKF88vBsIOJMV@gondor.apana.org.au>

On 11/06/25 15:23, Herbert Xu wrote:
> On Tue, Jun 03, 2025 at 06:07:29PM +0530, T Pratham wrote:
>>
>> +	// Need to do a timeout to ensure finalise gets called if DMA callback fails for any reason
>> +	ret = wait_for_completion_timeout(&rctx->aes_compl, msecs_to_jiffies(DTHE_DMA_TIMEOUT_MS));
> 
> This doesn't look safe.  What if the callback is invoked after a
> timeout? That would be a UAF.
> 
> Does the DMA engine provide any timeout mechanism? If not, then
> you could do it with a delayed work struct.  Just make sure that
> you cancel the work struct in the normal path callback.  Vice versa
> you need to terminate the DMA job in the timeout work struct.
> 
> Cheers,

Calling dma_terminate_sync() here should suffice I presume? I'll update the code accordingly.

Regards
T Pratham <t-pratham@ti.com>

  reply	other threads:[~2025-06-12 10:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250603124217.957116-1-t-pratham@ti.com>
     [not found] ` <20250603124217.957116-3-t-pratham@ti.com>
2025-06-11  9:53   ` [PATCH v5 2/2] crypto: ti: Add driver for DTHE V2 AES Engine (ECB, CBC) Herbert Xu
2025-06-12 10:15     ` T Pratham [this message]
2025-06-16  2:49       ` Herbert Xu
2025-06-18 17:53     ` 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=b27eab62-cfe0-4dfc-8429-ea464eef9e6f@ti.com \
    --to=t-pratham@ti.com \
    --cc=davem@davemloft.net \
    --cc=dmaengine@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kamlesh@ti.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-chawdhry@ti.com \
    --cc=praneeth@ti.com \
    --cc=vigneshr@ti.com \
    --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