public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Bianca Lutz <sowilo@cs.tu-berlin.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	a.p.zijlstra@chello.nl, schnhrr@cs.tu-berlin.de,
	sowilo@cs.tu-berlin.de, tglx@linutronix.de, mingo@elte.hu
Subject: [tip:sched/core] sched: Do not attempt to destroy uninitialized rt_bandwidth
Date: Thu, 21 Jul 2011 18:30:11 GMT	[thread overview]
Message-ID: <tip-99bc52429f11d1f4f81495ac8237085aaeb6bccf@git.kernel.org> (raw)
In-Reply-To: <1310580816-10861-7-git-send-email-schnhrr@cs.tu-berlin.de>

Commit-ID:  99bc52429f11d1f4f81495ac8237085aaeb6bccf
Gitweb:     http://git.kernel.org/tip/99bc52429f11d1f4f81495ac8237085aaeb6bccf
Author:     Bianca Lutz <sowilo@cs.tu-berlin.de>
AuthorDate: Wed, 13 Jul 2011 20:13:36 +0200
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Thu, 21 Jul 2011 18:01:51 +0200

sched: Do not attempt to destroy uninitialized rt_bandwidth

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>
---
 kernel/sched.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 3b3826e..f107204 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -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)

  reply	other threads:[~2011-07-21 18:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1310580816-10861-1-git-send-email-schnhrr@cs.tu-berlin.de>
2011-07-13 18:13 ` [PATCH 6/6] sched: Do not attempt to destroy uninitialized rt_bandwidth Jan H. Schönherr
2011-07-21 18:30   ` tip-bot for Bianca Lutz [this message]
     [not found] ` <1310580816-10861-6-git-send-email-schnhrr@cs.tu-berlin.de>
2011-07-13 20:44   ` [PATCH 5/6] sched: Use leaf_cfs_rqs in load_balance_fair() Peter Zijlstra
2011-07-14 16:46     ` Jan Schönherr
     [not found] ` <1310580816-10861-4-git-send-email-schnhrr@cs.tu-berlin.de>
2011-07-13 20:47   ` [PATCH 3/6] sched: Avoid redundant initialization of runqueues Peter Zijlstra
     [not found]     ` <1310661163-16606-1-git-send-email-schnhrr@cs.tu-berlin.de>
2011-07-15 10:14       ` [PATCH] sched: Separate group-scheduling code more clearly Peter Zijlstra
     [not found] ` <1310580816-10861-2-git-send-email-schnhrr@cs.tu-berlin.de>
2011-07-13 20:51   ` [PATCH 1/6] sched: Fix (harmless) typo 'CONFG_FAIR_GROUP_SCHED' Peter Zijlstra
2011-07-13 22:07     ` Jiri Kosina
2011-07-13 22:12       ` Peter Zijlstra
2011-07-13 22:25         ` Jiri Kosina
2011-07-13 22:37           ` Peter Zijlstra
2011-07-13 22:48             ` Jiri Kosina
2011-07-14 16:45               ` Jan Schönherr
2011-07-13 22:35         ` Jesper Juhl
2011-07-13 22:44           ` Peter Zijlstra
2011-07-13 23:03             ` Jesper Juhl
2011-07-13 23:18               ` Peter Zijlstra
2011-07-13 23:43                 ` Jesper Juhl
2011-07-14  8:53     ` Alan Cox
2011-07-14 12:50       ` Peter Zijlstra
2011-07-14 13:23         ` Alan Cox
2011-07-21 18:29   ` [tip:sched/core] " tip-bot for Jan Schoenherr
2011-07-13 20:58 ` [PATCH 0/6] Small scheduling cleanups Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-99bc52429f11d1f4f81495ac8237085aaeb6bccf@git.kernel.org \
    --to=sowilo@cs.tu-berlin.de \
    --cc=a.p.zijlstra@chello.nl \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=schnhrr@cs.tu-berlin.de \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox