From 0347e778ca67187aff6f1e175f9b7fa545917416 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Fri, 21 Jun 2013 19:20:31 +0200 Subject: [PATCH] bridge: don't crash on bandwidth unplug with no bandwidth If networkUnplugBandwidth is called on a network which has no bandwidth defined, print a warning instead of crashing. This can happen when destroying a domain with bandwidth if bandwidth was removed from the network after the domain was started. https://bugzilla.redhat.com/show_bug.cgi?id=975359 (cherry picked from commit 658c932ab4aec2222b0ce3840a96748e73b39b3f) --- src/network/bridge_driver.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 9664be5537..777024fbbb 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4750,6 +4750,11 @@ networkUnplugBandwidth(virNetworkObjPtr net, if (iface->data.network.actual && iface->data.network.actual->class_id) { + if (!net->def->bandwidth || !net->def->bandwidth->in) { + VIR_WARN("Network %s has no bandwidth but unplug requested", + net->def->name); + goto cleanup; + } /* we must remove class from bridge */ new_rate = net->def->bandwidth->in->average;