[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XENHID PATCH] thread: Wait for the thread if ObReferenceObjectByHandle fails


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Date: Mon, 26 Oct 2026 14:34:19 +0100
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=vates.tech header.i="@vates.tech" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:In-Reply-To:References:Feedback-ID"
  • Cc: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
  • Delivery-date: Mon, 26 Oct 2026 13:34:46 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

If ObReferenceObjectByHandle fails, the thread would have already
started. We need to wait for it to exit before cleaning up.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xenhid/thread.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/xenhid/thread.c b/src/xenhid/thread.c
index 954e060..24ffbce 100644
--- a/src/xenhid/thread.c
+++ b/src/xenhid/thread.c
@@ -30,6 +30,7 @@
  * SUCH DAMAGE.
  */
 
+#include <ntifs.h>
 #include <ntddk.h>
 
 #include "thread.h"
@@ -171,6 +172,7 @@ fail3:
     Error("fail3\n");
 
     __ThreadAlert(*Thread);
+    ZwWaitForSingleObject(Handle, FALSE, NULL);
     ZwClose(Handle);
 
 fail2:
-- 
2.56.0.windows.4



--
Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.