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:   Mon, 27 Mar 2023 20:37:28 +0000
From:   Chao Liu <liuchao173@...wei.com>
To:     <linux-kernel@...r.kernel.org>, <hewenliang4@...wei.com>
CC:     <tglx@...utronix.de>, <steven.price@....com>
Subject: [PATCH] cpu/hotplug: check the return value of idle_thread_get

ilde may be ERR_PTR()

Signed-off-by: Chao Liu <liuchao173@...wei.com>
---
 kernel/cpu.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index d0a9aa0b42e8..8ddf372e8d29 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -590,6 +590,9 @@ static int bringup_cpu(unsigned int cpu)
 	struct task_struct *idle = idle_thread_get(cpu);
 	int ret;
 
+	if (IS_ERR(idle))
+		return PTR_ERR(idle);
+
 	/*
 	 * Reset stale stack state from the last time this CPU was online.
 	 */
@@ -614,7 +617,12 @@ static int bringup_cpu(unsigned int cpu)
 static int finish_cpu(unsigned int cpu)
 {
 	struct task_struct *idle = idle_thread_get(cpu);
-	struct mm_struct *mm = idle->active_mm;
+	struct mm_struct *mm = NULL;
+
+	if (IS_ERR(idle))
+		return PTR_ERR(idle);
+
+	mm = idle->active_mm;
 
 	/*
 	 * idle_task_exit() will have switched to &init_mm, now
-- 
2.23.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ