If swtpm binary fails to start after successful exec() (e.g. it
fails to initialize itself), the seclabels set in
qemuSecurityStartTPMEmulator() are not restored. This is due to
lacking qemuSecurityRestoreTPMLabels() call in the error path.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
virTimeBackOffVar timebackoff;
const unsigned long long timeout = 1000; /* ms */
bool setTPMStateLabel = true;
+ bool teardownlabel = false;
int cmdret = 0;
pid_t pid = -1;
* already reported error. */
goto error;
}
+ teardownlabel = true;
if (virPidFileReadPath(pidfile, &pid) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
virProcessKillPainfully(pid, true);
if (pidfile)
unlink(pidfile);
+ if (teardownlabel)
+ qemuSecurityRestoreTPMLabels(driver, vm, setTPMStateLabel);
return -1;
}