Skip to content

Commit

Permalink
sched: Do not attempt to destroy uninitialized rt_bandwidth
Browse files Browse the repository at this point in the history
If a task group is to be created and alloc_fair_sched_group() fails,
then the rt_bandwidth of the corresponding task group is not yet
initialized. The caller, sched_create_group(), starts a clean up
procedure which calls free_rt_sched_group() which unconditionally
destroys the not yet initialized rt_bandwidth.

This crashes or hangs the system in lock_hrtimer_base(): UP systems
dereference a NULL pointer, while SMP systems loop endlessly on a
condition that cannot become true.

This patch simply avoids the destruction of rt_bandwidth when the
initialization code path was not reached.

(This was discovered by accident with a custom kernel modification.)

Signed-off-by: Bianca Lutz <sowilo@cs.tu-berlin.de>
Signed-off-by: Jan Schoenherr <schnhrr@cs.tu-berlin.de>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1310580816-10861-7-git-send-email-schnhrr@cs.tu-berlin.de
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Bianca Lutz authored and Ingo Molnar committed Jul 21, 2011
1 parent 045176d commit 99bc524
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -8383,7 +8383,8 @@ static void free_rt_sched_group(struct task_group *tg)
{
int i;

destroy_rt_bandwidth(&tg->rt_bandwidth);
if (tg->rt_se)
destroy_rt_bandwidth(&tg->rt_bandwidth);

for_each_possible_cpu(i) {
if (tg->rt_rq)
Expand Down

0 comments on commit 99bc524

Please sign in to comment.