i386/tdx: Remove task->watch only when it's valid
PATCH 1/1 i386/tdx: Remove task->watch only when it's valid
In some case (e.g., failed to connect to QGS socket), tdx_generate_quote_cleanup() is called with task->watch invalid. It triggers assertion of
qemu-system-x86_64: GLib: g_source_remove: assertion 'tag > 0' failed
Fix it by checking task->watch.
Fixes 40da501d8989 ("i386/tdx: handle TDG.VP.VMCALL<GetQuote>")
Signed-off-by Xiaoyao Li <[email protected]>
--- target/i386/kvm/tdx-quote-generator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
target/i386/kvm/tdx-quote-generator.c +3 -1
@@ -75,7 +75,9 @@ static void tdx_generate_quote_cleanup(TdxGenerateQuoteTask *task) {timer_del (&task->timer); -g_source_remove (task->watch); +if (task->watch) { +g_source_remove (task->watch); + }qio_channel_close (QIO_CHANNEL (task->sioc),NULL );object_unref (OBJECT (task->sioc));
Signature · 1 line
2.43.0
Quoted 11 lines · Xiaoyao Li
Date: Wed, 25 Jun 2025 11:55:05 +0800
From: Xiaoyao Li <[email protected]>
Subject: [PATCH] i386/tdx: Removetask->watchonly when it's valid
X-Mailer: git-send-email 2.43.0In some case (e.g., failed to connect to QGS socket),
tdx_generate_quote_cleanup()is called withtask->watchinvalid. It triggers assertion ofqemu-system-x86_64: GLib:
g_source_remove: assertion 'tag > 0' failed
Quoted 7 lines
Fix it by checking
task->watch.Fixes 40da501d8989 ("i386/tdx: handle TDG.VP.VMCALL<GetQuote>")Signed-off-by Xiaoyao Li <[email protected]>--- target/i386/kvm/tdx-quote-generator.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by Zhao Liu <[email protected]>
Paolo Bonzini
AppliedQueued, thanks.
Paolo