]> git.proxmox.com Git - mirror_qemu.git/commit
crypto: Forbid broken unloading of secrets
authorKevin Wolf <kwolf@redhat.com>
Mon, 30 Nov 2020 10:56:13 +0000 (11:56 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 29 Jan 2021 17:07:53 +0000 (17:07 +0000)
commit668cb74b2af1129349a6c41763bc88d801161e09
tree3160d1c4426cd4c1c7a1ececb58b910229ab57aa
parent31b6aefdbd9d2fe45c25e5236e1cc363229cb96c
crypto: Forbid broken unloading of secrets

qcrypto_secret_prop_set_loaded() forgets to reset secret->rawdata after
unloading a secret, which will lead to a double free at some point.

Because there is no use case for unloading an already loaded secret
(apart from deleting the whole secret object) and we know that nobody
could use this because it would lead to crashes, let's just forbid the
operation instead of fixing the unloading.

Eventually, we'll want to get rid of 'loaded' in the external interface,
but for the meantime this is more consistent with rng, which has a
similar property 'opened' that also can't be reset to false after it
became true.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
crypto/secret_common.c