summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Blum <blum@kernel.org>2026-09-08 09:53:40 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2026-09-18 19:52:43 +1000
commit016f22d2268e02df705868110fe4e402b51bfffc (patch)
tree111ca5461e5f61d61f9424cdaefba2b2e1da0e24
parent9695df3b1db4ac4534274d38ee16e3b9b0bf910e (diff)
downloadlinux-next-016f22d2268e02df705868110fe4e402b51bfffc.tar.gz
linux-next-016f22d2268e02df705868110fe4e402b51bfffc.zip
crypto: zynqmp-sha - fix NULL pointer dereference in init_tfm
zynqmp_sha_init_tfm() checks crypto_shash_statesize(tfm_ctx->fbk_tfm) before assigning the fallback transform to it, which dereferences a NULL pointer since the transform context is zero-initialized. Use the local fallback_tfm pointer for the size check instead. Fixes: c1dd353d18e5 ("crypto: zynqmp-sha - Make descsize an algorithm attribute") Cc: stable@vger.kernel.org Signed-off-by: Thorsten Blum <blum@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--drivers/crypto/xilinx/zynqmp-sha.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/xilinx/zynqmp-sha.c b/drivers/crypto/xilinx/zynqmp-sha.c
index 5813017b6b79..cd051e1f4275 100644
--- a/drivers/crypto/xilinx/zynqmp-sha.c
+++ b/drivers/crypto/xilinx/zynqmp-sha.c
@@ -59,7 +59,7 @@ static int zynqmp_sha_init_tfm(struct crypto_shash *hash)
return PTR_ERR(fallback_tfm);
if (crypto_shash_descsize(hash) <
- crypto_shash_statesize(tfm_ctx->fbk_tfm)) {
+ crypto_shash_statesize(fallback_tfm)) {
crypto_free_shash(fallback_tfm);
return -EINVAL;
}