From 5290ca53a976132ae30df5c9b9798cd70af1df21 Mon Sep 17 00:00:00 2001 From: John Ferlan Date: Mon, 2 Apr 2018 09:43:50 -0400 Subject: [PATCH] lxc: Fix object locking after virDomainObjListRemove The virDomainObjListRemove will return an unlocked @vm after calling with a reffed object, thus prior to calling virDomainObjEndAPI we should relock. Signed-off-by: John Ferlan --- src/lxc/lxc_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 54f853cbae..9cf67b9854 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -493,6 +493,7 @@ lxcDomainDefineXMLFlags(virConnectPtr conn, const char *xml, unsigned int flags) if (virDomainSaveConfig(cfg->configDir, driver->caps, vm->newDef ? vm->newDef : vm->def) < 0) { virDomainObjListRemove(driver->domains, vm); + virObjectLock(vm); goto cleanup; } @@ -557,6 +558,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom, vm->persistent = 0; } else { virDomainObjListRemove(driver->domains, vm); + virObjectLock(vm); } ret = 0; @@ -1529,8 +1531,10 @@ lxcDomainDestroyFlags(virDomainPtr dom, endjob: virLXCDomainObjEndJob(driver, vm); - if (!vm->persistent) + if (!vm->persistent) { virDomainObjListRemove(driver->domains, vm); + virObjectLock(vm); + } cleanup: virDomainObjEndAPI(&vm); -- GitLab