Re: [PATCH 2/2] bridge: don't crash on bandwidth unplug with no bandwidth

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/21/2013 01:30 PM, Ján Tomko wrote:
> 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 bandwith if

s/bandwith/bandwidth

> bandwidth was removed from the network after the domain was
> started.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=975359
> ---
>  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 f7c2470..72a3f70 100644
> --- a/src/network/bridge_driver.c
> +++ b/src/network/bridge_driver.c
> @@ -4808,6 +4808,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;
>  
> 
I don't know the code well enough - I can understand why there's a crash
if bandwidth == NULL; however, it wasn't clear to me whether or not it
might be necessary to make the other calls that didn't rely on bandwidth
!= NULL but do pass/use class_id.

John

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]