Message ID | 20240304122031.25325-1-amishin@t-argos.ru (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show |
Series | crypto: rockchip/rk3288 - Add dereference of NULL pointer check | expand |
diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index 70edf40bc523..88cea1e36afa 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -371,6 +371,10 @@ static int rk_crypto_probe(struct platform_device *pdev) } crypto_info->engine = crypto_engine_alloc_init(&pdev->dev, true); + if (!crypto_info->engine) { + dev_err(&pdev->dev, "memory allocation failed.\n"); + goto err_crypto; + } crypto_engine_start(crypto_info->engine); init_completion(&crypto_info->complete);
In rk_crypto_probe() crypto_engine_alloc_init() is assigned to crypto_info->engine and there is a dereference of it in clk_mt2712_top_init_early() which could lead to a NULL pointer dereference on failure of crypto_engine_alloc_init(). Fix this bug by adding a check of crypto_info->engine. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 57d67c6e8219 ("crypto: rockchip - rework by using crypto_engine") Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru> --- drivers/crypto/rockchip/rk3288_crypto.c | 4 ++++ 1 file changed, 4 insertions(+)