public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: "Horia Geantă" <horia.geanta@nxp.com>
Cc: Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Pankaj Gupta <pankaj.gupta@nxp.com>,
	Gaurav Jain <gaurav.jain@nxp.com>,
	Paul Bunyan <pbunyan@redhat.com>
Subject: Re: [PATCH] crypto: caam - Fix DMA corruption on long hmac keys
Date: Tue, 24 Mar 2026 18:51:41 +0900	[thread overview]
Message-ID: <acJerX5liyO2tQ-B@gondor.apana.org.au> (raw)
In-Reply-To: <d1bd8cf9-db43-4e36-869f-ecb953dd82e6@nxp.com>

On Tue, Mar 10, 2026 at 05:12:10PM +0200, Horia Geantă wrote:
> 
> When aligned_len is bigger than keylen, kmemdup would go beyond the end of
> "key" buffer.
> 
> Looks like kzalloc + memcpy should be used instead of kmemdup.
> 
> Double checking the faulty commit, I've found the same pattern in
> ahash_setkey from drivers/crypto/caam/caamalg_qi2.c. Let me know if you'd
> send a fix for this or I should do it.

Hi Horia:

While we should still fix this, it turns out that the original
problem went beyond the memory allocation.

The root cause of the self-test failure is actually caused by
the parallel self-test mechanism which became the default in
2024.

It appears the caam is unable to deal with this because the
ahash_setkey function will fail if caam_jr_enqueue returns
ENOSPC, which is bound to happen sooner or later in a parallel
environment.

So it'll either need to deal with ENOSPC, or switch to a
software fallback.

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      parent reply	other threads:[~2026-03-24  9:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-09  9:14 [PATCH] crypto: caam - Fix DMA corruption on long hmac keys Herbert Xu
2026-03-10 15:12 ` Horia Geantă
2026-03-11  4:15   ` Herbert Xu
2026-03-24  9:51   ` Herbert Xu [this message]

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=acJerX5liyO2tQ-B@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=gaurav.jain@nxp.com \
    --cc=horia.geanta@nxp.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=pankaj.gupta@nxp.com \
    --cc=pbunyan@redhat.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