From: Robin Murphy <robin.murphy@arm.com>
To: Rosen Penev <rosenp@gmail.com>, linux-crypto@vger.kernel.org
Cc: Srujana Challa <schalla@marvell.com>,
Bharat Bhushan <bbhushan2@marvell.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Boris Brezillon <bbrezillon@kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] crypto: cesa: check for sram_dma NULL
Date: Mon, 13 Jul 2026 12:58:19 +0100 [thread overview]
Message-ID: <3d606437-ab63-41e7-88d3-fb6e47014a8a@arm.com> (raw)
In-Reply-To: <20260713050740.3687230-1-rosenp@gmail.com>
On 13/07/2026 6:07 am, Rosen Penev wrote:
> dma_map_resource() might fail. In such a case, don't call
> dma_unmap_resource()
Hmm, AFAICS it's more that if *anything* in mv_cesa_get_sram() fails, we
could end up calling dma_unmap_resource() via the cleanup path for
subsequent engines which never had their mv_cesa_get_sram() call at all
(and thus all of engine->pool, engine->sram and engine->sram_dma will be
unset). While for one where dma_map_resource() itself did fail,
engine->sram_dma will be non-NULL here (but still invalid to unmap). I
think this needs a bit more work to differentiate between the
successfully initialised state which needs cleanup, and the partially or
fully-uninitialised states which don't.
Thanks,
Robin.
> Fixes: 37d728f76c41 ("crypto: marvell/cesa - Fix DMA API misuse")
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/crypto/marvell/cesa/cesa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/marvell/cesa/cesa.c b/drivers/crypto/marvell/cesa/cesa.c
> index 57c9295be711..bcbb909c48d8 100644
> --- a/drivers/crypto/marvell/cesa/cesa.c
> +++ b/drivers/crypto/marvell/cesa/cesa.c
> @@ -406,7 +406,7 @@ static void mv_cesa_put_sram(struct platform_device *pdev, int idx)
> if (engine->pool)
> gen_pool_free(engine->pool, (unsigned long)engine->sram_pool,
> cesa->sram_size);
> - else
> + else if (engine->sram_dma)
> dma_unmap_resource(cesa->dev, engine->sram_dma,
> cesa->sram_size, DMA_BIDIRECTIONAL, 0);
> }
next prev parent reply other threads:[~2026-07-13 11:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 5:07 Rosen Penev
2026-07-13 11:58 ` Robin Murphy [this message]
2026-07-13 19:50 ` Rosen Penev
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=3d606437-ab63-41e7-88d3-fb6e47014a8a@arm.com \
--to=robin.murphy@arm.com \
--cc=bbhushan2@marvell.com \
--cc=bbrezillon@kernel.org \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=schalla@marvell.com \
/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