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]
Date:   Tue, 28 Nov 2023 22:15:08 -0800
From:   Haoran Liu <liuhaoran14@....com>
To:     linux@...linux.org.uk
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Haoran Liu <liuhaoran14@....com>
Subject: [PATCH] [ARM] tcm: Add error handling for gen_pool_create in setup_tcm_pool

The new code checks the return value of gen_pool_create, and if
it indicates an error, the setup process is aborted, and an
appropriate error code is returned. This ensures that the TCM pool
setup does not silently fail.

Signed-off-by: Haoran Liu <liuhaoran14@....com>
---
 arch/arm/kernel/tcm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c
index f59927bcfbce..df25d310abc3 100644
--- a/arch/arm/kernel/tcm.c
+++ b/arch/arm/kernel/tcm.c
@@ -393,6 +393,10 @@ static int __init setup_tcm_pool(void)
 	 * line alignments does not matter in TCM!
 	 */
 	tcm_pool = gen_pool_create(2, -1);
+	if (!tcm_pool) {
+		pr_err("Failed to create TCM memory pool\n");
+		return -ENOMEM;
+	}
 
 	pr_debug("Setting up TCM memory pool\n");
 
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ