mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Ingo Molnar <mingo@redhat.com>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>
Subject: [PATCH] stacktrace: don't crash on invalid stack trace structs
Date: Sun, 04 May 2008 14:39:21 +0200	[thread overview]
Message-ID: <1209904761.4065.19.camel@johannes.berg> (raw)

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];
 



             reply	other threads:[~2008-05-04 12:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-04 12:39 Johannes Berg [this message]
2008-05-05  6:31 ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1209904761.4065.19.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®