qemuDomainDetachWatchdog: Don't release watchdog address twice

On watchdog unplug, when qemu doesn't support DEVICE_DELETED event
(or couple of other reasons) we do two things:

1) release watchdog device address,
2) call qemuDomainRemoveWatchdog() which does 1) again.

This is potentially dangerous.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik 2018-05-23 18:35:52 +02:00
parent c2fa7e7ffc
commit ee87e5de36

View File

@ -5344,11 +5344,9 @@ qemuDomainDetachWatchdog(virQEMUDriverPtr driver,
ret = -1;
if (ret == 0) {
if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1) {
qemuDomainReleaseDeviceAddress(vm, &watchdog->info, NULL);
if ((ret = qemuDomainWaitForDeviceRemoval(vm)) == 1)
ret = qemuDomainRemoveWatchdog(driver, vm, watchdog);
}
}
qemuDomainResetDeviceRemoval(vm);
return ret;