]> git.ipfire.org Git - thirdparty/linux.git/commit
crypto: caam - fix DMA corruption on long hmac keys
authorHoria Geantă <horia.geanta@nxp.com>
Tue, 17 Mar 2026 10:25:13 +0000 (12:25 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 26 Mar 2026 09:10:58 +0000 (18:10 +0900)
commit5ddfdcbe10dc5f97afc4e46ca22be2be717e8caf
treef7836f8e697afbc596fbd089078ffbb8ede34253
parent4b56770d345524fc2acc143a2b85539cf7d74bc1
crypto: caam - fix DMA corruption on long hmac keys

When a key longer than block size is supplied, it is copied and then
hashed into the real key.  The memory allocated for the copy needs to
be rounded to DMA cache alignment, as otherwise the hashed key may
corrupt neighbouring memory.

The rounding was performed, but never actually used for the allocation.
Fix this by replacing kmemdup with kmalloc for a larger buffer,
followed by memcpy.

Fixes: 199354d7fb6e ("crypto: caam - Remove GFP_DMA and add DMA alignment padding")
Reported-by: Paul Bunyan <pbunyan@redhat.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/caam/caamhash.c