[libvirt] [PATCH] Fix a crash when using Open vSwitch virtual ports

Kyle Mestery (kmestery) kmestery at cisco.com
Thu Aug 30 13:11:01 UTC 2012


On Aug 30, 2012, at 3:52 AM, Laine Stump wrote:
> On 08/30/2012 01:32 AM, Eric Blake wrote:
>> [...]
>> That is, I think the real patch here would be simply this (untested)
>> version:
>> 
>> diff --git i/src/util/virnetdevopenvswitch.c
>> w/src/util/virnetdevopenvswitch.c
>> index b903ae4..e8b9f4a 100644
>> --- i/src/util/virnetdevopenvswitch.c
>> +++ w/src/util/virnetdevopenvswitch.c
>> @@ -59,7 +59,7 @@ int virNetDevOpenvswitchAddPort(const char *brname,
>> const char *ifname,
>>     char *ifaceid_ex_id = NULL;
>>     char *profile_ex_id = NULL;
>>     char *vmid_ex_id = NULL;
>> -    virBufferPtr buf;
>> +    virBufferPtr buf = NULL;
>> 
>>     virMacAddrFormat(macaddr, macaddrstr);
>>     virUUIDFormat(ovsport->interfaceID, ifuuidstr);
>> @@ -79,7 +79,7 @@ int virNetDevOpenvswitchAddPort(const char *brname,
>> const char *ifname,
>>                         ovsport->profileID) < 0)
>>             goto out_of_memory;
>>     }
>> -    if (virtVlan) {
>> +    if (virtVlan && virtVlan->tag[0]) {
> 
> If you were to believe that virtVlan might be sent with no tags (which
> isn't the case with my patch applied...), then checking for non-0
> virtVLan->tag[0] without checking for non-NULL virtVlan->tag would
> itself lead to a crash.


Just saw all the cleanups to this patch and the fact it was pushed. Thanks for all the
comments and cleanups to it Erik and Laine! And thanks for pushing it up.

Kyle




More information about the libvir-list mailing list