[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] xentop: fix NULL pointer dereference
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1274361007 -3600 # Node ID 11a3bf0e568ebc1e167740f51713a4a05e4e136d # Parent 840f269d95fb8e7367753612fffabc521be8df9e 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> --- tools/xenstat/libxenstat/src/xenstat_linux.c | 28 ++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-) diff -r 840f269d95fb -r 11a3bf0e568e tools/xenstat/libxenstat/src/xenstat_linux.c --- a/tools/xenstat/libxenstat/src/xenstat_linux.c Wed May 19 22:59:52 2010 +0100 +++ b/tools/xenstat/libxenstat/src/xenstat_linux.c Thu May 20 14:10:07 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |