]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Don't leak storage perms on failure in qemuDomainAttachDiskGeneric
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 28 Jun 2019 06:17:45 +0000 (08:17 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 17 Dec 2019 09:04:44 +0000 (10:04 +0100)
commitda27be1b096cfcbc54d7b30379b7a6fb0d2de69d
treed8e6058d36ec6c86b0e2d9fa4500d1ec7655dc72
parent1038505420adbc54506e1bd1ab35a3e411706a09
qemu: Don't leak storage perms on failure in qemuDomainAttachDiskGeneric

At the very beginning of the attach function the
qemuDomainStorageSourceChainAccessAllow() is called which
modifies CGroups, locks and seclabels for new disk and its
backing chain. This must be followed by a counterpart which
reverts back all the changes if something goes wrong. This boils
down to calling qemuDomainStorageSourceChainAccessRevoke() which
is done under 'error' label. But not all failure branches jump
there. They just jump onto 'cleanup' label where no revoke is
done. Such mistake is easy to do because 'cleanup' label does
exist. Therefore, dissolve 'error' block in 'cleanup' and have
everything jump onto 'cleanup' label.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
src/qemu/qemu_hotplug.c