Skip to contentSkip to conversation

i386/tdx: Remove task->watch only when it's valid

PATCH Applied Xiaoyao Li 3 participants 3 messages Jun 25, 2025 – Jul 11, 2025 x86 trust domain extensions (TDX)

lore
Share & tools
lore

Xiaoyao Li

author
#0 lore raw

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>")
---
 target/i386/kvm/tdx-quote-generator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
target/i386/kvm/tdx-quote-generator.c +3 -1
index f59715f61751..dee8334b27ac 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Xiaoyao Li

Date: Wed, 25 Jun 2025 11:55:05 +0800
From: Xiaoyao Li <[email protected]>
Subject: [PATCH] i386/tdx: Remove task->watch only when it's valid
X-Mailer: git-send-email 2.43.0

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

Quoted 7 lines

Fix it by checking task->watch.

Fixes 40da501d8989 ("i386/tdx: handle TDG.VP.VMCALL<GetQuote>")
---
 target/i386/kvm/tdx-quote-generator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)