[libvirt] [PATCH 1/6] conf: net: Fix helper for applying new network definition

Laine Stump laine at laine.org
Thu Oct 25 21:10:59 UTC 2012


On 10/25/2012 04:39 PM, Peter Krempa wrote:
> On 10/25/12 22:34, Laine Stump wrote:
>> On 10/25/2012 11:18 AM, Peter Krempa wrote:
>>> When there's no new definition the helper overwrote the old one with
>>> NULL.
>>> ---
>>>   src/conf/network_conf.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
>>> index 8976f2a..93d1b4c 100644
>>> --- a/src/conf/network_conf.c
>>> +++ b/src/conf/network_conf.c
>>> @@ -359,7 +359,7 @@ virNetworkObjSetDefTransient(virNetworkObjPtr
>>> network, bool live)
>>>   void
>>>   virNetworkObjUnsetDefTransient(virNetworkObjPtr network)
>>>   {
>>> -    if (network->def) {
>>> +    if (network->newDef) {
>>>           virNetworkDefFree(network->def);
>>>           network->def = network->newDef;
>>>           network->newDef = NULL;
>>
>> Yes. ACK. (/raises hand acknowledging the screwup)
>
> Thanks.
>
>>
>> BTW, although the change is correct, it currently is a NOP:
>>
>> 1) in the case of a persistent network, but def and newDef are always
>> non-NULL when this is called,
>> 2) in the case of a transient network, when this is called, the very
>> next thing that happens is always to delete the entire networkObj.
>
> In a patch 4/6 of this series, I added code that accesses the
> definition right before tne network object is discarded. This caused
> segfault of the daemon when I tried to get rid of the dnsmasq and
> radvd status files when removing a network completely.

Aha!




More information about the libvir-list mailing list