mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
qemu_hotplug: fix crash in hot(un)plugging chardev devices
We need to make sure that the chardev is TCP. Without this check we may access different part of union and corrupt pointers. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
6262a9b282
commit
0810782664
@ -1729,7 +1729,8 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
|
|||||||
if (qemuDomainChrPreInsert(vmdef, chr) < 0)
|
if (qemuDomainChrPreInsert(vmdef, chr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (cfg->chardevTLS) {
|
if (dev->type == VIR_DOMAIN_CHR_TYPE_TCP &&
|
||||||
|
cfg->chardevTLS) {
|
||||||
if (qemuBuildTLSx509BackendProps(cfg->chardevTLSx509certdir,
|
if (qemuBuildTLSx509BackendProps(cfg->chardevTLSx509certdir,
|
||||||
dev->data.tcp.listen,
|
dev->data.tcp.listen,
|
||||||
cfg->chardevTLSx509verify,
|
cfg->chardevTLSx509verify,
|
||||||
@ -4398,7 +4399,8 @@ int qemuDomainDetachChrDevice(virQEMUDriverPtr driver,
|
|||||||
|
|
||||||
sa_assert(tmpChr->info.alias);
|
sa_assert(tmpChr->info.alias);
|
||||||
|
|
||||||
if (cfg->chardevTLS &&
|
if (tmpChr->source.type == VIR_DOMAIN_CHR_TYPE_TCP &&
|
||||||
|
cfg->chardevTLS &&
|
||||||
!(objAlias = qemuAliasTLSObjFromChardevAlias(tmpChr->info.alias)))
|
!(objAlias = qemuAliasTLSObjFromChardevAlias(tmpChr->info.alias)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user