From: Michal Privoznik Date: Wed, 10 Sep 2025 09:43:53 +0000 (+0200) Subject: ch: Unlock domain in virCHEventStopProcess() on all exit paths X-Git-Tag: v11.8.0-rc1~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=06802eeceb81d4a544b7777ef100d0dfcd00cf97;p=thirdparty%2Flibvirt.git ch: Unlock domain in virCHEventStopProcess() on all exit paths The aim of virCHEventStopProcess() is to clean up after stopped domain by calling virCHProcessStop(). But in order to do that it needs to acquire a job and in order to do that it needs to lock the domain object. Well, the object is not unlocked in all exit paths, i.e. when job acquiring fails the domain object is left locked. Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/ch/ch_events.c b/src/ch/ch_events.c index 25c7ecf90a..cd2f92a493 100644 --- a/src/ch/ch_events.c +++ b/src/ch/ch_events.c @@ -55,13 +55,12 @@ virCHEventStopProcess(virDomainObj *vm, virDomainShutoffReason reason) { virCHDriver *driver = CH_DOMAIN_PRIVATE(vm)->driver; + VIR_LOCK_GUARD lock = virObjectLockGuard(vm); - virObjectLock(vm); if (virDomainObjBeginJob(vm, VIR_JOB_DESTROY)) return -1; virCHProcessStop(driver, vm, reason, VIR_CH_PROCESS_STOP_FORCE); virDomainObjEndJob(vm); - virObjectUnlock(vm); return 0; }