From: Martin Drab <[email protected]>

It seems the handle is not being closed when QGA is freeing its communication 
channel. The open handle prevents the serial device from being removed. That 
may happen, for example, when the Virtio serial driver fails to restart its 
devices after HW resource reassignment due to a CPU/memory hotplug.

This fix adds the handle closing code into the ga_channel_free function. Only 
QGA for Windows is being fixed.

Signed-Off-By: Martin Drab <[email protected]>
---
 qga/channel-win32.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/qga/channel-win32.c b/qga/channel-win32.c
index 779007e39b..520cd6ae50 100644
--- a/qga/channel-win32.c
+++ b/qga/channel-win32.c
@@ -354,6 +354,12 @@ void ga_channel_free(GAChannel *c)
     if (c->rstate.ov.hEvent) {
         CloseHandle(c->rstate.ov.hEvent);
     }
+
+    if (c->handle) {
+        CancelIo(c->handle);
+        CloseHandle(c->handle);
+    }
+
     g_free(c->rstate.buf);
     g_free(c);
 }
-- 
2.39.1.windows.1


Reply via email to