[ltt-dev] [PATCH] lttng: fix net events to check for null n->dev

Gregory Haskins ghaskins at novell.com
Fri Mar 27 13:13:20 EDT 2009


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





More information about the lttng-dev mailing list