qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386/tdx: Remove task->watch only when it's valid
@ 2025-06-25  3:55 Xiaoyao Li
  2025-06-27  8:42 ` Zhao Liu
  2025-07-11  8:45 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Xiaoyao Li @ 2025-06-25  3:55 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti; +Cc: qemu-devel, xiaoyao.li

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 <xiaoyao.li@intel.com>
---
 target/i386/kvm/tdx-quote-generator.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/i386/kvm/tdx-quote-generator.c b/target/i386/kvm/tdx-quote-generator.c
index f59715f61751..dee8334b27ac 100644
--- a/target/i386/kvm/tdx-quote-generator.c
+++ b/target/i386/kvm/tdx-quote-generator.c
@@ -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));
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-11  9:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25  3:55 [PATCH] i386/tdx: Remove task->watch only when it's valid Xiaoyao Li
2025-06-27  8:42 ` Zhao Liu
2025-07-11  8:45 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).