From: Dan Carpenter Date: Thu, 15 Aug 2024 11:20:20 +0000 (+0300) Subject: crypto: spacc - Check for allocation failure in spacc_skcipher_fallback() X-Git-Tag: v6.12-rc1~231^2~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b1c9df662915a18a86f1a88364ee70875ed3b44;p=thirdparty%2Fkernel%2Flinux.git crypto: spacc - Check for allocation failure in spacc_skcipher_fallback() Check for crypto_alloc_skcipher() failure. Fixes: c8981d9230d8 ("crypto: spacc - Add SPAcc Skcipher support") Signed-off-by: Dan Carpenter Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/dwc-spacc/spacc_skcipher.c b/drivers/crypto/dwc-spacc/spacc_skcipher.c index 488c03ff6c36c..8c698b75dd925 100644 --- a/drivers/crypto/dwc-spacc/spacc_skcipher.c +++ b/drivers/crypto/dwc-spacc/spacc_skcipher.c @@ -67,6 +67,8 @@ static int spacc_skcipher_fallback(unsigned char *name, tctx->fb.cipher = crypto_alloc_skcipher(name, CRYPTO_ALG_TYPE_SKCIPHER, CRYPTO_ALG_NEED_FALLBACK); + if (IS_ERR(tctx->fb.cipher)) + return PTR_ERR(tctx->fb.cipher); crypto_skcipher_set_reqsize(reqtfm, sizeof(struct spacc_crypto_reqctx) +