From: Daniel P. Berrange Date: Thu, 21 Apr 2011 16:23:13 +0000 (+0100) Subject: Close all sockets before cancelling QEMU migration X-Git-Tag: CVE-2011-2178~181 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bf92bb829975371e7b580c18d2b3dfbcff405b4;p=thirdparty%2Flibvirt.git Close all sockets before cancelling QEMU migration Cancelling the QEMU migration may cause QEMU to flush pending data on the migration socket. This may in turn block QEMU if nothing reads from the other end of the socket. Closing the socket before cancelling QEMU migration avoids this possible deadlock. * src/qemu/qemu_migration.c: Close sockets before cancelling migration on failure --- diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b132d860cd..0e9d2d2f48 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1494,6 +1494,8 @@ static int doTunnelMigrate(struct qemud_driver *driver, cancel: if (ret != 0 && virDomainObjIsActive(vm)) { + VIR_FORCE_CLOSE(client_sock); + VIR_FORCE_CLOSE(qemu_sock); qemuDomainObjEnterMonitorWithDriver(driver, vm); qemuMonitorMigrateCancel(priv->mon); qemuDomainObjExitMonitorWithDriver(driver, vm);