Skip to content

Commit 7625b3a

Browse files
vittyvktorvalds
authored andcommitted
kernel/panic.c: turn off locks debug before releasing console lock
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]>
1 parent 9d8a765 commit 7625b3a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

kernel/panic.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,11 @@ void panic(const char *fmt, ...)
152152
* We may have ended up stopping the CPU holding the lock (in
153153
* smp_send_stop()) while still having some valuable data in the console
154154
* buffer. Try to acquire the lock then release it regardless of the
155-
* result. The release will also print the buffers out.
155+
* result. The release will also print the buffers out. Locks debug
156+
* should be disabled to avoid reporting bad unlock balance when
157+
* panic() is not being callled from OOPS.
156158
*/
159+
debug_locks_off();
157160
console_trylock();
158161
console_unlock();
159162

0 commit comments

Comments
 (0)