lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240304122031.25325-1-amishin@t-argos.ru>
Date: Mon, 4 Mar 2024 15:20:31 +0300
From: Aleksandr Mishin <amishin@...rgos.ru>
To: Corentin Labbe <clabbe@...libre.com>
CC: Aleksandr Mishin <amishin@...rgos.ru>, Herbert Xu
	<herbert@...dor.apana.org.au>, "David S . Miller" <davem@...emloft.net>,
	Heiko Stuebner <heiko@...ech.de>, <linux-crypto@...r.kernel.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-rockchip@...ts.infradead.org>,
	<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] crypto: rockchip/rk3288 - Add dereference of NULL pointer check

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@...rgos.ru>
---
 drivers/crypto/rockchip/rk3288_crypto.c | 4 ++++
 1 file changed, 4 insertions(+)

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);
 
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ