WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-4.0-testing] xentop: fix NULL pointer dereference

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-4.0-testing] xentop: fix NULL pointer dereference
From: "Xen patchbot-4.0-testing" <patchbot-4.0-testing@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 21 May 2010 23:20:27 -0700
Delivery-date: Fri, 21 May 2010 23:20:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1274506857 -3600
# Node ID 89616846ff4cbe77b1ea2e71ebc05812f7d4f900
# Parent  a1b50472c2859b97f0185a9d2152e29d3d022b6e
xentop: fix NULL pointer dereference

On my system, I'm getting SIGSEGVs in xentop because
xenstat_node_domain() is returning NULL.  Skip the loop if it does
rather than crashing.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   21439:11a3bf0e568e
xen-unstable date:        Thu May 20 14:10:07 2010 +0100
---
 tools/xenstat/libxenstat/src/xenstat_linux.c |   28 ++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff -r a1b50472c285 -r 89616846ff4c 
tools/xenstat/libxenstat/src/xenstat_linux.c
--- a/tools/xenstat/libxenstat/src/xenstat_linux.c      Wed May 19 20:50:07 
2010 +0100
+++ b/tools/xenstat/libxenstat/src/xenstat_linux.c      Sat May 22 06:40:57 
2010 +0100
@@ -292,20 +292,22 @@ int xenstat_collect_networks(xenstat_nod
 
                /* If the device parsed is network bridge and both tx & rx 
packets are zero, we are most */
                /* likely using bonding so we alter the configuration for dom0 
to have bridge stats */
-               if ((strstr(iface, devBridge) != NULL) && (strstr(iface, 
devNoBridge) == NULL)) {
-                       domain = xenstat_node_domain(node, 0);
+               if ((strstr(iface, devBridge) != NULL) &&
+                   (strstr(iface, devNoBridge) == NULL) &&
+                   ((domain = xenstat_node_domain(node, 0)) != NULL)) {
                        for (i = 0; i < domain->num_networks; i++) {
-                               if ((domain->networks[i].id == 0) && 
(domain->networks[i].tbytes == 0)
-                                       && (domain->networks[i].rbytes == 0)) {
-                                               domain->networks[i].tbytes = 
txBytes;
-                                               domain->networks[i].tpackets = 
txPackets;
-                                               domain->networks[i].terrs = 
txErrs;
-                                               domain->networks[i].tdrop = 
txDrops;
-                                               domain->networks[i].rbytes = 
rxBytes;
-                                               domain->networks[i].rpackets = 
rxPackets;
-                                               domain->networks[i].rerrs = 
rxErrs;
-                                               domain->networks[i].rdrop = 
rxDrops;
-                               }
+                               if ((domain->networks[i].id != 0) ||
+                                   (domain->networks[i].tbytes != 0) ||
+                                   (domain->networks[i].rbytes != 0))
+                                       continue;
+                               domain->networks[i].tbytes = txBytes;
+                               domain->networks[i].tpackets = txPackets;
+                               domain->networks[i].terrs = txErrs;
+                               domain->networks[i].tdrop = txDrops;
+                               domain->networks[i].rbytes = rxBytes;
+                               domain->networks[i].rpackets = rxPackets;
+                               domain->networks[i].rerrs = rxErrs;
+                               domain->networks[i].rdrop = rxDrops;
                        }
                }
                else /* Otherwise we need to preserve old behaviour */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-4.0-testing] xentop: fix NULL pointer dereference, Xen patchbot-4.0-testing <=