[libvirt] [PATCH] virnwfilterbindingobj: Introduce and use virNWFilterBindingObjStealDef

Ján Tomko jtomko at redhat.com
Wed Mar 20 13:25:24 UTC 2019


On Wed, Mar 20, 2019 at 11:31:57AM +0100, Michal Privoznik wrote:
>https://bugzilla.redhat.com/show_bug.cgi?id=1686927
>
>When trying to create a nwfilter binding via
>nwfilterBindingCreateXML() we may encounter a crash. The sequence
>of functions called is as follows:
>
>1) nwfilterBindingCreateXML() parses the XML and calls
>virNWFilterBindingObjListAdd() which calls
>virNWFilterBindingObjListAddLocked()
>
>2) Here, @binding is not found because binding->remove is set.
>
>3) Therefore, controls continue with creating new @binding,
>setting its def to the one from 1) and adding it to the hash
>table.
>
>4) This fails, because the binding is still in the hash table
>(duplicate key is detected).
>
>5) The control jumps to 'error' label where
>virNWFilterBindingObjEndAPI() is called which frees the binding
>definition passed.
>
>6) Error is propagated to the caller, which calls
>virNWFilterBindingDefFree() over the definition again.
>
>The solution is to unset binding->def in case of failure so it's
>not freed in step 5).
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
>
>Technically, this is a v2 of:
>
>https://www.redhat.com/archives/libvir-list/2019-March/msg01209.html
>
>But since this one implements different approach than v1 I'm not marking
>it as such.
>
> src/conf/virnwfilterbindingobj.c     | 10 ++++++++++
> src/conf/virnwfilterbindingobj.h     |  3 +++
> src/conf/virnwfilterbindingobjlist.c |  4 ++++
> src/libvirt_private.syms             |  1 +
> 4 files changed, 18 insertions(+)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190320/ddda6b53/attachment-0001.sig>


More information about the libvir-list mailing list