[libvirt] Re: [PATCH] Fix possible NULL pointer dereference

Daniel Veillard veillard at redhat.com
Mon Dec 14 13:11:29 UTC 2009


On Mon, Dec 14, 2009 at 12:22:40PM +0100, Paolo Bonzini wrote:
> If there are no references remaining to the object, vm is set to NULL
> and vm->persistent cannot be accessed.  Fixed by this trivial patch.
> 
> * src/qemu/qemu_driver.c (qemudDomainCoreDump): Avoid possible
> NULL pointer dereference on --crash dump.
> ---
>         >   Okay, I have pushed the 2 patches, I got a merge error in the
>         > cleanup section of the QEmu dump entry point, which I manually
>         > applied hope it's fine, I also had to cleanup some TAB used for
>         > indentation (hint use "make syntax-check" to catch those),
> 
>         Here is a little adjustment.  Thanks!
> 
>  src/qemu/qemu_driver.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 3946c27..faeb838 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -3914,7 +3914,7 @@ endjob:
>  
>      if (qemuDomainObjEndJob(vm) == 0)
>          vm = NULL;
> -    if ((ret == 0) && (flags & VIR_DUMP_CRASH) && !vm->persistent) {
> +    else if ((ret == 0) && (flags & VIR_DUMP_CRASH) && !vm->persistent) {
>          virDomainRemoveInactive(&driver->domains,
>                                  vm);
>          vm = NULL;

  Oops I didn't realized that vm could be NULL there when fixing
the merge conflict !

  thanks for catching this, pushed !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list