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: <20250913042315.1292065-1-kaushlendra.kumar@intel.com>
Date: Sat, 13 Sep 2025 09:53:15 +0530
From: Kaushlendra Kumar <kaushlendra.kumar@...el.com>
To: mingo@...hat.com,
	peterz@...radead.org,
	juri.lelli@...hat.com,
	vincent.guittot@...aro.org,
	dietmar.eggemann@....com,
	rostedt@...dmis.org
Cc: linux-kernel@...r.kernel.org,
	Kaushlendra Kumar <kaushlendra.kumar@...el.com>
Subject: [PATCH] sched/deadline: Add bounds check in cpudl_maximum()

Add a bounds check to cpudl_maximum() to prevent accessing cp->elements[0]
when the heap is empty. Return -1 when cp->size is 0 to indicate that no
valid CPU is available in the deadline heap.

Without this check, accessing cp->elements[0] when the heap is empty could
lead to undefined behavior.

Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@...el.com>
---
 kernel/sched/cpudeadline.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 0f7127b3a05c..dd736e3879c8 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -103,6 +103,8 @@ static void cpudl_heapify(struct cpudl *cp, int idx)
 
 static inline int cpudl_maximum(struct cpudl *cp)
 {
+	if (cp->size == 0)
+		return -1;
 	return cp->elements[0].cpu;
 }
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ