Skip to content

Commit

Permalink
kernel/panic.c: turn off locks debug before releasing console lock
Browse files Browse the repository at this point in the history
Commit 08d7865 ("panic: release stale console lock to always get the
logbuf printed out") introduced an unwanted bad unlock balance report when
panic() is called directly and not from OOPS (e.g.  from out_of_memory()).
The difference is that in case of OOPS we disable locks debug in
oops_enter() and on direct panic call nobody does that.

Fixes: 08d7865 ("panic: release stale console lock to always get the logbuf printed out")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Vitaly Kuznetsov <[email protected]>
Cc: HATAYAMA Daisuke <[email protected]>
Cc: Masami Hiramatsu <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Baoquan He <[email protected]>
Cc: Prarit Bhargava <[email protected]>
Cc: Xie XiuQi <[email protected]>
Cc: Seth Jennings <[email protected]>
Cc: "K. Y. Srinivasan" <[email protected]>
Cc: Jan Kara <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Yasuaki Ishimatsu <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
vittyvk authored and torvalds committed Nov 21, 2015
1 parent 9d8a765 commit 7625b3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kernel/panic.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,11 @@ void panic(const char *fmt, ...)
* We may have ended up stopping the CPU holding the lock (in
* smp_send_stop()) while still having some valuable data in the console
* buffer. Try to acquire the lock then release it regardless of the
* result. The release will also print the buffers out.
* result. The release will also print the buffers out. Locks debug
* should be disabled to avoid reporting bad unlock balance when
* panic() is not being callled from OOPS.
*/
debug_locks_off();
console_trylock();
console_unlock();

Expand Down

0 comments on commit 7625b3a

Please sign in to comment.