]> git.ipfire.org Git - thirdparty/libvirt.git/commit
network: fix crash during cleanup from failure to allocate port
authorLaine Stump <laine@redhat.com>
Fri, 16 Aug 2019 01:52:28 +0000 (21:52 -0400)
committerLaine Stump <laine@redhat.com>
Fri, 16 Aug 2019 15:58:30 +0000 (11:58 -0400)
commitdac697e8d7d6d9a607e61caeeec06b259edf513f
tree0f9846cf79132d3f0dbbba3b2a46925524bb36d2
parent8d6eaf5e099dab8400aa76bcc9a0ac74ff6f46e1
network: fix crash during cleanup from failure to allocate port

During networkPortCreateXML, if networkAllocatePort() failed,
networkReleasePort() would be called, which would (in the case of
network pools of macvtap passthrough devices) attempt to find the
allocated device by comparing port->plug.direct.linkdev to each device
in the pool. Since port->plug.direct.linkdev was still NULL, the
attempted strcmp would result in a SEGV.

Calling networkReleasePort() during error cleanup is something that
should only be done if networkAllocatePort() has already succeeded. It
turns out there is one other possible error exit from
networkPortCreateXML() that happens after networkAllocatePort() has
succeeded, so the code to call networkReleasePort() was just moved
down to there.

Resolves: https://bugzilla.redhat.com/1741390

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/network/bridge_driver.c