提交 bfeeeeb9 编写于 作者: J Johannes Berg 提交者: Thomas Gleixner

stacktrace: don't crash on invalid stack trace structs

This patch makes the stacktrace printout code \warn when the entries
pointer is unset rather than crashing when trying to access it in an
attempt to make it a bit more robust.

I was saving a stacktrace into an skb and forgot to copy it across skb
copies... I have since fixed the code, but it would have been easier
had the kernel not crashed in an interrupt.
Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 75d3bce2
...@@ -13,6 +13,9 @@ void print_stack_trace(struct stack_trace *trace, int spaces) ...@@ -13,6 +13,9 @@ void print_stack_trace(struct stack_trace *trace, int spaces)
{ {
int i, j; int i, j;
if (WARN_ON(!trace->entries))
return;
for (i = 0; i < trace->nr_entries; i++) { for (i = 0; i < trace->nr_entries; i++) {
unsigned long ip = trace->entries[i]; unsigned long ip = trace->entries[i];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册