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

[XENIFACE-SYNC 3/3] xeniface: Don't remove a NULL watch on resume


  • To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Date: Thu, 22 Oct 2026 13:43:59 +0200
  • 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: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
  • Delivery-date: Thu, 22 Oct 2026 11:44:10 +0000
  • Feedback-id: default:8631fc262581453bbf619ec5b2062170:Sweego
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>

If StartWatch() fails, Watch->WatchHandle stays NULL. On the next
suspend/resume, SessionWatchThread() then passes NULL to
XENBUS_STORE(WatchRemove), which dereferences it in xenbus.

Only remove the watch if it was set up, as the other callers already
do, and still call StartWatch() so the watch is set up again.

Signed-off-by: Césaire Mounah <cesaire.mounah@xxxxxxxxxx>
---
 src/xeniface/wmi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/xeniface/wmi.c b/src/xeniface/wmi.c
index f2b4802..5ba7645 100644
--- a/src/xeniface/wmi.c
+++ b/src/xeniface/wmi.c
@@ -994,8 +994,10 @@ WatchCallbackThread(
                 Watch->SuspendCount = XENBUS_SUSPEND(GetCount, 
&Watch->Fdo->SuspendInterface);
                 Info("SessionSuspendResumeUnwatch %p\n", Watch->WatchHandle);
 
-                XENBUS_STORE(WatchRemove, &Watch->Fdo->StoreInterface, 
Watch->WatchHandle);
-                Watch->WatchHandle = NULL;
+                if (Watch->WatchHandle != NULL) {
+                    XENBUS_STORE(WatchRemove, &Watch->Fdo->StoreInterface, 
Watch->WatchHandle);
+                    Watch->WatchHandle = NULL;
+                }
                 StartWatch(Watch->Fdo, Watch);
             } else {
                 FireWatch(Watch);
-- 
2.55.0.windows.5



--
Césaire Mounah | Vates Windows Guest Tools Engineer

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®.