lkml.org 
[lkml]   [2008]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH] stacktrace: don't crash on invalid stack trace structs
From
Date
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.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
I was saving a stacktrace into an skb and forgot to copy it across skb
copies... Not sure if you want this, I have since fixed the code, but it
would have been easier had the kernel not crashed in an interrupt.

--- everything.orig/kernel/stacktrace.c 2008-05-04 14:02:14.000000000 +0200
+++ everything/kernel/stacktrace.c 2008-05-04 14:02:24.000000000 +0200
@@ -13,6 +13,9 @@ void print_stack_trace(struct stack_trac
{
int i, j;

+ if (WARN_ON(!trace->entries))
+ return;
+
for (i = 0; i < trace->nr_entries; i++) {
unsigned long ip = trace->entries[i];




\
 
 \ /
  Last update: 2008-05-04 14:41    [W:0.019 / U:28.132 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site