Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: ghaskins@novell.com (Gregory Haskins)
Subject: [ltt-dev] [PATCH] lttng: fix net events to check for null n->dev
Date: Fri, 27 Mar 2009 13:13:20 -0400	[thread overview]
Message-ID: <20090327170721.16456.25463.stgit@dev.haskins.net> (raw)

Hi Mathieu, LTT devs,
  I found that I needed this patch to allow LTT 0.116 to play nice with
  v2.6.29.  I am not 100% sure that I am not papering over a legitimate
  issue w.r.t napi->dev being legally NULL.  But FWIW, this patch allowed
  me to get 0.116 up and running.  Note that I saw the same issue in 0.110
  against 29-rc8, but I didnt persue since the newer trees were available.
  I suspect the same patch would fix things there as well.

  FWIW: The devices in question seemed to be the built-in skb-queues that
  are used as a psuedo device when you use netif_rx().  In these cases
  dev == NULL (not sure if this is by design).  However, since this path
  is probably not that common unless you are using something like tuntap,
  I suspect it might be that this has just been a latent bug in LTT.

Regards,
-Greg

-------------------
lttng: fix net events to check for null n->dev

Applies to 29-v0.116

Certain napi structures may have a NULL device, and thus will crash when
the net-tracer'er is installed.

Signed-off-by: Gregory Haskins <ghaskins at novell.com>
---

 ltt/probes/net-trace.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/ltt/probes/net-trace.c b/ltt/probes/net-trace.c
index 80254bb..80d3d9c 100644
--- a/ltt/probes/net-trace.c
+++ b/ltt/probes/net-trace.c
@@ -260,7 +260,7 @@ notrace void probe_net_napi_schedule(struct napi_struct *n)
 	data.f1 = (unsigned long)n;
 	data_len += sizeof(data.f1);
 	/* No need to align for strings */
-	strcpy(data.f2, n->dev->name);
+	strcpy(data.f2, n->dev ? n->dev->name : "<unk>");
 	data_len += strlen(data.f2) + 1;
 
 	marker = &GET_MARKER(net, napi_schedule);
@@ -283,7 +283,7 @@ notrace void probe_net_napi_poll(struct napi_struct *n)
 	data.f1 = (unsigned long)n;
 	data_len += sizeof(data.f1);
 	/* No need to align for strings */
-	strcpy(data.f2, n->dev->name);
+	strcpy(data.f2, n->dev ? n->dev->name : "<unk>");
 	data_len += strlen(data.f2) + 1;
 
 	marker = &GET_MARKER(net, napi_poll);
@@ -306,7 +306,7 @@ notrace void probe_net_napi_complete(struct napi_struct *n)
 	data.f1 = (unsigned long)n;
 	data_len += sizeof(data.f1);
 	/* No need to align for strings */
-	strcpy(data.f2, n->dev->name);
+	strcpy(data.f2, n->dev ? n->dev->name : "<unk>");
 	data_len += strlen(data.f2) + 1;
 
 	marker = &GET_MARKER(net, napi_complete);





             reply	other threads:[~2009-03-27 17:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 17:13 Gregory Haskins [this message]
2009-03-27 17:52 ` Mathieu Desnoyers

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=20090327170721.16456.25463.stgit@dev.haskins.net \
    --to=ghaskins@novell.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