[libvirt] [PATCH] Fix crash in virNetDevGetVirtualFunctions

Laine Stump laine at laine.org
Tue Apr 9 18:41:28 UTC 2013


On 04/09/2013 02:21 PM, Eric Blake wrote:
> On 04/09/2013 12:15 PM, Laine Stump wrote:
>> Commit 9a3ff01d7f16cc280ce3176620c0714f55511a65 (which was ACKed at
>> the end of January, but for some reason didn't get pushed until during
>> the 1.0.4 freeze) fixed the logic in virPCIGetVirtualFunctions().
>> Unfortunately, a typo in the fix (replacing VIR_REALLOC_N with
>> VIR_ALLOC_N during code movement) caused not only a memory leak, but
>> also resulted in most of the elements of the result array being
>> replaced with NULL. virNetDevGetVirtualFunctions() assumed (and I think
>> rightly so) that virPCIGetVirtualFunctions() wouldn't return any NULL
>> elements in the array, so it ended up segfaulting.
> What a difference two characters makes.

And difficult to catch in the middle of a bunch of other changes. It
would sure be nice to have a box running a few SRIOV regression tests
somewhere. Because it's apparently mostly used only in production
environments, it ends up being very late in the cycle when problems are
caught (and problems are coming up regardless of whether or not code in
libvirt is changed; see
https://bugzilla.redhat.com/show_bug.cgi?id=908888 for a Fedora-specific
example)


> ACK. 


Pushed. Thanks!

(I noticed there is a v1.0.4-maint branch so (although nothing else had
been pushed there since the release of 1.0.4) I pushed this patch to
that branch as well.)




More information about the libvir-list mailing list