[libvirt] [PATCH] qemu: Don't crash in qemuDomainOpenChannel()
Eric Blake
eblake at redhat.com
Mon Mar 2 17:35:47 UTC 2015
On 03/02/2015 09:22 AM, Martin Kletzander wrote:
> The problem here was that when opening a channel, we were checking
> whether the channel given is alias (can't be NULL for running domain) or
> it's name, which can be NULL (for example with spicevmc). In case of
> such domain qemuDomainOpenChannel() made the daemon crash.
> STREQ_NULLABLE() is safe to use since the code in question is wrapped in
> "if (name)" and is more readable, so use that instead of checking for
> non-NULL "vm->def->channels[i]->target.name".
>
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
> src/qemu/qemu_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
ACK
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 83a4e18..c87cc05 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -15450,7 +15450,7 @@ qemuDomainOpenChannel(virDomainPtr dom,
>
> if (vm->def->channels[i]->targetType == \
> VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO &&
> - STREQ(name, vm->def->channels[i]->target.name))
> + STREQ_NULLABLE(name, vm->def->channels[i]->target.name))
> chr = vm->def->channels[i];
> }
> } else {
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150302/79f69802/attachment-0001.sig>
More information about the libvir-list
mailing list