Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 2638

kernel-2.6.18-238.el5.src.rpm

From: Neil Horman <nhorman@redhat.com>
Date: Tue, 15 Sep 2009 16:11:22 -0400
Subject: [net] fix drop monitor to not panic on null dev
Message-id: 20090915201122.GI1366@hmsreliant.think-freely.org
O-Subject: [RHEL 5.5 PATCH]: fix drop monitor to not panic on null dev (bz 523279)
Bugzilla: 523279
RH-Acked-by: David Miller <davem@redhat.com>
RH-Acked-by: Dean Nelson <dnelson@redhat.com>
RH-Acked-by: Rik van Riel <riel@redhat.com>
RH-Acked-by: Prarit Bhargava <prarit@redhat.com>

Hey all-
	A customer has been messing with dropwatch, and they noticed a panic that
has since been fixed upstream.  This patch is a massage of upstream commit
f2798eb4e01b095f273f4bf40f511c9d69c0e1da which fixes it.  Satisfies bz 523279

diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 8016ac4..bc86ca9 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -173,13 +173,23 @@ static void trace_napi_poll_hit(struct net_device *napi)
 {
 	struct dm_hw_stat_delta *new_stat;
  	struct net_device_stats *stats;
+
+	if (!napi)
+		return;
  
 	/*
 	 * Ratelimit our check time to dm_hw_check_delta jiffies
 	 */
 	if (!time_after(jiffies, napi->last_rx + dm_hw_check_delta))
 		return;
-  
+
+	if (!napi->get_stats)  
+		return;
+
+	stats = napi->get_stats(napi);
+	if (!stats)
+		return;
+
 	rcu_read_lock();
 	list_for_each_entry_rcu(new_stat, &hw_stats_list, list) {
 		stats = napi->get_stats(napi);