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>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 7 Mar 2024 16:23:40 +0300
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Ingo Molnar <mingo@...hat.com>
CC: Daniil Dulov <d.dulov@...ddin.ru>, Peter Zijlstra <peterz@...radead.org>,
	Juri Lelli <juri.lelli@...hat.com>, Vincent Guittot
	<vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel
 Gorman <mgorman@...e.de>, Daniel Bristot de Oliveira <bristot@...hat.com>,
	Valentin Schneider <vschneid@...hat.com>, <linux-kernel@...r.kernel.org>,
	<lvc-project@...uxtesting.org>
Subject: [PATCH] sched/topology: Check return value of zalloc_cpumask_var()

zalloc_cpumask_var() returns false if mask was not allocated.
So, let's check if cpu masks are allocated successfully.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 8d5dc5126bb2 ("sched/topology: Small cleanup")
Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
---
 kernel/sched/topology.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
index 10d1391e7416..2df98ffdfe16 100644
--- a/kernel/sched/topology.c
+++ b/kernel/sched/topology.c
@@ -2600,9 +2600,10 @@ int __init sched_init_domains(const struct cpumask *cpu_map)
 {
 	int err;
 
-	zalloc_cpumask_var(&sched_domains_tmpmask, GFP_KERNEL);
-	zalloc_cpumask_var(&sched_domains_tmpmask2, GFP_KERNEL);
-	zalloc_cpumask_var(&fallback_doms, GFP_KERNEL);
+	if (!zalloc_cpumask_var(&sched_domains_tmpmask, GFP_KERNEL) ||
+	    !zalloc_cpumask_var(&sched_domains_tmpmask2, GFP_KERNEL) ||
+	    !zalloc_cpumask_var(&fallback_doms, GFP_KERNEL))
+		return -ENOMEM;
 
 	arch_update_cpu_topology();
 	asym_cpu_capacity_scan();
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ