[PATCH -mm] bug if setscheduler is called from interrupt context.

From: Steven Rostedt
Date: Fri Jun 23 2006 - 05:27:38 EST



Thomas Gleixner is adding the call to a rtmutex function in setscheduler.
This call grabs a spin_lock that is not always protected by interrupts
disabled. So this means that setscheduler cant be called from interrupt
context.

To prevent this from happening in the future, this patch adds a
BUG_ON(in_interrupt()) in that function. (Thanks to akpm <aka. Andrew
Morton> for this suggestion).

-- Steve

Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>

Index: linux-2.6.17-mm1/kernel/sched.c
===================================================================
--- linux-2.6.17-mm1.orig/kernel/sched.c 2006-06-23 05:19:41.000000000 -0400
+++ linux-2.6.17-mm1/kernel/sched.c 2006-06-23 05:20:44.000000000 -0400
@@ -4034,6 +4034,8 @@ int sched_setscheduler(struct task_struc
unsigned long flags;
runqueue_t *rq;

+ /* may grab non-irq protected spin_locks */
+ BUG_ON(in_interrupt());
recheck:
/* double check policy once rq lock held */
if (policy < 0)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/