]> xenbits.xensource.com Git - libvirt.git/commit
Fix libvirtd free() segfault when migrating guest with deleted open vswitch port
authorJason J. Herne <jjherne@linux.vnet.ibm.com>
Tue, 26 Jan 2016 18:25:17 +0000 (13:25 -0500)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 27 Jan 2016 09:01:58 +0000 (10:01 +0100)
commit871e10fc959afd9c56bd1f512d89ce591d2207b9
tree857d7e63cc193548edb730a263688d1936a0f244
parent370608b4c76f7290cbebc4e4a05fca4eb0e9ffe8
Fix libvirtd free() segfault when migrating guest with deleted open vswitch port

libvirtd crashes on free()ing portData for an open vswitch port if that port
was deleted.  To reproduce:

ovs-vsctl del-port vnet0
virsh migrate --live kvm1 qemu+ssh://dstHost/system

Error message:
libvirtd: *** Error in `/usr/sbin/libvirtd': free(): invalid pointer: 0x000003ff90001e20 ***

The problem is that virCommandRun can return an empty string in the event that
the port being queried does not exist. When this happens then we are
unconditionally overwriting a newline character at position strlen()-1. When
strlen is 0, we overwrite memory that does not belong to the string.

The fix: Only overwrite the newline if the string is not empty.

Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
src/util/virnetdevopenvswitch.c