summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJason Wessel <jason.wessel@windriver.com>2012-04-12 12:49:17 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-22 15:38:56 -0700
commite8514a06812f2fb3409d52fa604a2a340b0a1720 (patch)
tree4d32f266d836cb6c188be72fad94462cf209d0cd /kernel
parent6295ae34d2b032c25566e5f3fbc211f9db5126ac (diff)
downloadlwn-e8514a06812f2fb3409d52fa604a2a340b0a1720.tar.gz
lwn-e8514a06812f2fb3409d52fa604a2a340b0a1720.zip
panic: fix stack dump print on direct call to panic()
commit 026ee1f66aaa7f01b617a0ba89ac4b531f9603f1 upstream. Commit 6e6f0a1f0fa6 ("panic: don't print redundant backtraces on oops") causes a regression where no stack trace will be printed at all for the case where kernel code calls panic() directly while not processing an oops, and of course there are 100's of instances of this type of call. The original commit executed the check (!oops_in_progress), but this will always be false because just before the dump_stack() there is a call to bust_spinlocks(1), which does the following: void __attribute__((weak)) bust_spinlocks(int yes) { if (yes) { ++oops_in_progress; The proper way to resolve the problem that original commit tried to solve is to avoid printing a stack dump from panic() when the either of the following conditions is true: 1) TAINT_DIE has been set (this is done by oops_end()) This indicates and oops has already been printed. 2) oops_in_progress > 1 This guards against the rare case where panic() is invoked a second time, or in between oops_begin() and oops_end() Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Cc: Andi Kleen <ak@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/panic.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index 80aed44e345a..8ed89a175d79 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -97,7 +97,7 @@ void panic(const char *fmt, ...)
/*
* Avoid nested stack-dumping if a panic occurs during oops processing
*/
- if (!oops_in_progress)
+ if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
dump_stack();
#endif