Skip to content

Commit

Permalink
lockdep: fix debug_show_all_locks()
Browse files Browse the repository at this point in the history
fix the oops that can be seen in:

   http://bugzilla.kernel.org/attachment.cgi?id=13828&action=view

it is not safe to print the locks of running tasks.

(even with this fix we have a small race - but this is a debug
 function after all.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
  • Loading branch information
Ingo Molnar committed Dec 5, 2007
1 parent 41a2d6c commit 8568487
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kernel/lockdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3173,6 +3173,13 @@ void debug_show_all_locks(void)
printk(" locked it.\n");

do_each_thread(g, p) {
/*
* It's not reliable to print a task's held locks
* if it's not sleeping (or if it's not the current
* task):
*/
if (p->state == TASK_RUNNING && p != current)
continue;
if (p->lockdep_depth)
lockdep_print_held_locks(p);
if (!unlock)
Expand Down

0 comments on commit 8568487

Please sign in to comment.