[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] qemu: Fix crash on failed VM startup



On Tue, Jun 01, 2010 at 03:10:19PM -0400, Cole Robinson wrote:
> If VM startup fails early enough (can't find a referenced USB device),
> libvirtd will crash trying to clear the VNC port bit, since port = 0,
> which overflows us out of the bitmap bounds.

Why is port '0' in the first place ? Don't we always have it 
initialized to '-1' when autoport is true.

> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c8cd50a..f5a1310 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3741,7 +3741,7 @@ retry:
>      if ((vm->def->ngraphics == 1) &&
>          vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
>          vm->def->graphics[0]->data.vnc.autoport &&
> -        vm->def->graphics[0]->data.vnc.port != -1) {
> +        vm->def->graphics[0]->data.vnc.port >= QEMU_VNC_PORT_MIN) {
>          if (virBitmapClearBit(driver->reservedVNCPorts,
>                                vm->def->graphics[0]->data.vnc.port - \
>                                QEMU_VNC_PORT_MIN) < 0) {


Daniel
-- 
|: Red Hat, Engineering, London    -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :|
|: http://autobuild.org        -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]