tpm-passthrough: make it safer to destroy after creation
Check fds values before closing, to avoid close(-1). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
This commit is contained in:
parent
9f7c0ef2ff
commit
8df4d8484f
@ -347,8 +347,12 @@ static void tpm_passthrough_inst_finalize(Object *obj)
|
||||
|
||||
tpm_passthrough_cancel_cmd(TPM_BACKEND(obj));
|
||||
|
||||
qemu_close(tpm_pt->tpm_fd);
|
||||
qemu_close(tpm_pt->cancel_fd);
|
||||
if (tpm_pt->tpm_fd >= 0) {
|
||||
qemu_close(tpm_pt->tpm_fd);
|
||||
}
|
||||
if (tpm_pt->cancel_fd >= 0) {
|
||||
qemu_close(tpm_pt->cancel_fd);
|
||||
}
|
||||
qapi_free_TPMPassthroughOptions(tpm_pt->options);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user