public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] time/timgr: Fix wrong reference when level 0 group allocation failed
@ 2024-05-01 19:51 Levi Yun
  2024-05-04  4:47 ` Yun Levi
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Levi Yun @ 2024-05-01 19:51 UTC (permalink / raw)
  To: anna-maria, frederic, tglx; +Cc: linux-kernel, Levi Yun

When tmigr_setup_groups() failed level 0 group allocation,
next do while loop refers wrong local stack array location.

Changing group init do while loop with while loop to fix this problem.

Signed-off-by: Levi Yun <ppbuk5246@gmail.com>
---
 kernel/time/timer_migration.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index ccba875d2234..84413114db5c 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1596,7 +1596,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
 
 	} while (i < tmigr_hierarchy_levels);
 
-	do {
+	while (i > 0) {
 		group = stack[--i];
 
 		if (err < 0) {
@@ -1645,7 +1645,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
 				tmigr_connect_child_parent(child, group);
 			}
 		}
-	} while (i > 0);
+	}
 
 	kfree(stack);
 
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-08  9:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01 19:51 [PATCH] time/timgr: Fix wrong reference when level 0 group allocation failed Levi Yun
2024-05-04  4:47 ` Yun Levi
2024-05-04 10:09 ` Markus Elfring
2024-05-05  8:57 ` [PATCH RESEND] " Levi Yun
2024-05-05 10:23   ` Markus Elfring
2024-05-05 10:55     ` Yun Levi
2024-05-05 10:54   ` [PATCH v2] " Levi Yun
2024-05-05 17:07     ` [v2] " Markus Elfring
2024-05-06  4:10   ` [PATCH v3] " Levi Yun
2024-05-06 10:10     ` Frederic Weisbecker
2024-05-08  6:16       ` Anna-Maria Behnsen
2024-05-08  6:38         ` [v3] " Markus Elfring
2024-05-08  9:45     ` [tip: timers/urgent] timers/migration: Prevent out of bounds access on failure tip-bot2 for Levi Yun
2024-05-08  9:57       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox