[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZjisiuqiR9p76YcJ@localhost.localdomain>
Date: Mon, 6 May 2024 12:10:18 +0200
From: Frederic Weisbecker <frederic@...nel.org>
To: Levi Yun <ppbuk5246@...il.com>
Cc: anna-maria@...utronix.de, tglx@...utronix.de, Markus.Elfring@....de,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] time/timgr: Fix wrong reference when level 0 group
allocation failed
Le Mon, May 06, 2024 at 05:10:59AM +0100, Levi Yun a écrit :
> When tmigr_setup_groups() failed level 0 group allocation,
> wrong reference happens on local stack array while intializing timer hierarchy.
>
> To prevent this, Check loop condition first before initializing timer hierarchy.
>
> Fixes: 7ee988770326 ("timers: Implement the hierarchical pull model")
> Signed-off-by: Levi Yun <ppbuk5246@...il.com>
> ---
> v3:
> - Fix typo.
>
> v2:
> - Modify commit message.
>
> 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);
> + }
Looks good to me. But let's wait for Anna-Maria's second look. The group setup
is not my favourite area...
Thanks.
>
> kfree(stack);
>
> --
> 2.41.0
Powered by blists - more mailing lists