]> xenbits.xensource.com Git - people/pauldu/xenvif.git/commitdiff
Fix locking and teardown bugs in controller frontend
authorPaul Durrant <paul.durrant@citrix.com>
Wed, 27 Jul 2016 12:33:56 +0000 (13:33 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Wed, 27 Jul 2016 12:33:56 +0000 (13:33 +0100)
If the backend does not implement the control ring then the frontend will
eventually deadlock. Also, by inspection, the teardown code does not
release interfaces if the control ring was not present.

This patch fixes both issues.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xenvif/controller.c

index e54c9fce1bbcf6a500ffe4771bbb4ee881638147..a90397a5df4d6f6fafd5d9e8dc1dde9d91b80911 100644 (file)
@@ -797,8 +797,10 @@ ControllerDisconnect(
 
     __ControllerAcquireLock(Controller);
 
-    if (!Controller->Connected)
+    if (!Controller->Connected) {
+        __ControllerReleaseLock(Controller);
         goto done;
+    }
 
     Controller->Connected = FALSE;
 
@@ -837,6 +839,7 @@ ControllerDisconnect(
                   Controller->GnttabCache);
     Controller->GnttabCache = NULL;
 
+done:
     XENBUS_GNTTAB(Release, &Controller->GnttabInterface);
 
     XENBUS_EVTCHN(Release, &Controller->EvtchnInterface);
@@ -845,7 +848,6 @@ ControllerDisconnect(
 
     XENBUS_DEBUG(Release, &Controller->DebugInterface);
 
-done:
     Trace("<====\n");
 }