summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Driver.c
diff options
context:
space:
mode:
authorSorin Vinturis <svinturis@cloudbasesolutions.com>2015-01-26 19:00:40 +0000
committerBen Pfaff <blp@nicira.com>2015-01-30 13:26:57 -0800
commit448d667b7b9b1d7ebd9b4cb3338ffea33158c579 (patch)
tree6e7ca1a356cfb2df7b4a799e83677124d9169188 /datapath-windows/ovsext/Driver.c
parent7be0b8a0b0703719397763b3b588720f3b25ec13 (diff)
downloadopenvswitch-448d667b7b9b1d7ebd9b4cb3338ffea33158c579.tar.gz
datapath-windows: Solved BSOD when loading an activated extension
If the OVS extension was previously enabled and the driver unloaded, when the driver is loaded again a BSOD is triggered. This happens because the OVS extension registers its FilterXxx routines to NDIS, by calling NdisFRegisterFilterDriver, before performing all the necessary initialization. Because drivers that call NdisFRegisterFilterDriver must be prepared for an immediate call to any of their FilterXxx functions. The BSOD is triggered because the FilterAttach routine, OvsExtAttach, tries to acquire the control lock, when the lock is not yet initialized. This happens because the FilterAttach is called before the driver finishes initialization, in OvsInit(). The solution is to perform all necessary initialization before registering OVS FilterXxx routines. If device object creation fails, all allocated resources during init phase are released by calling OvsCleanup and NdisFDeregisterFilterDriver functions. Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-by: Sorin Vinturis <svinturis@cloudbasesolutions.com> Reported-at: https://github.com/openvswitch/ovs-issues/issues/67 Acked-by: Nithin Raju <nithin@vmware.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
Diffstat (limited to 'datapath-windows/ovsext/Driver.c')
-rw-r--r--datapath-windows/ovsext/Driver.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/datapath-windows/ovsext/Driver.c b/datapath-windows/ovsext/Driver.c
index 0a9c35ab2..13fcde200 100644
--- a/datapath-windows/ovsext/Driver.c
+++ b/datapath-windows/ovsext/Driver.c
@@ -95,6 +95,9 @@ DriverEntry(PDRIVER_OBJECT driverObject,
UNREFERENCED_PARAMETER(registryPath);
+ /* Initialize driver associated data structures. */
+ OvsInit();
+
gOvsExtDriverObject = driverObject;
RtlZeroMemory(&driverChars, sizeof driverChars);
@@ -145,6 +148,7 @@ DriverEntry(PDRIVER_OBJECT driverObject,
/* Create the communication channel for usersapce. */
status = OvsCreateDeviceObject(gOvsExtDriverHandle);
if (status != NDIS_STATUS_SUCCESS) {
+ OvsCleanup();
NdisFDeregisterFilterDriver(gOvsExtDriverHandle);
gOvsExtDriverHandle = NULL;
}
@@ -163,7 +167,11 @@ OvsExtUnload(struct _DRIVER_OBJECT *driverObject)
{
UNREFERENCED_PARAMETER(driverObject);
+ /* Release driver associated data structures. */
+ OvsCleanup();
+
OvsDeleteDeviceObject();
+
NdisFDeregisterFilterDriver(gOvsExtDriverHandle);
}