Skip to content

Commit

Permalink
sched: fix double kfree in failure path
Browse files Browse the repository at this point in the history
It's not the responsibility of init_rootdomain() to free root_domain
allocated by alloc_rootdomain().

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Li Zefan authored and Ingo Molnar committed Jan 6, 2009
1 parent d9be28e commit 0c910d2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -6970,7 +6970,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem)
}

if (!alloc_cpumask_var(&rd->span, GFP_KERNEL))
goto free_rd;
goto out;
if (!alloc_cpumask_var(&rd->online, GFP_KERNEL))
goto free_span;
if (!alloc_cpumask_var(&rd->rto_mask, GFP_KERNEL))
Expand All @@ -6986,8 +6986,7 @@ static int init_rootdomain(struct root_domain *rd, bool bootmem)
free_cpumask_var(rd->online);
free_span:
free_cpumask_var(rd->span);
free_rd:
kfree(rd);
out:
return -ENOMEM;
}

Expand Down

0 comments on commit 0c910d2

Please sign in to comment.