Ensure gOvsExtDriverHandle is not used if initialization fails
Added PAGED_CODE() where needed
Signed-off-by: Paul-Daniel Boca
Acked-by: Sorin Vinturis
---
datapath-windows/ovsext/Datapath.c | 4 +++-
datapath-windows/ovsext/Driver.c | 9 +
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/datapath-windows/ovsext/Datapath.c
b/datapath-windows/ovsext/Datapath.c
index 0a25af0..06f99b3 100644
--- a/datapath-windows/ovsext/Datapath.c
+++ b/datapath-windows/ovsext/Datapath.c
@@ -616,6 +616,7 @@ OvsOpenCloseDevice(PDEVICE_OBJECT deviceObject,
POVS_DEVICE_EXTENSION ovsExt =
(POVS_DEVICE_EXTENSION)NdisGetDeviceReservedExtension(deviceObject);
+PAGED_CODE();
ASSERT(deviceObject == gOvsDeviceObject);
ASSERT(ovsExt != NULL);
@@ -648,7 +649,7 @@ NTSTATUS
OvsCleanupDevice(PDEVICE_OBJECT deviceObject,
PIRP irp)
{
-
+PAGED_CODE();
PIO_STACK_LOCATION irpSp;
PFILE_OBJECT fileObject;
@@ -696,6 +697,7 @@ OvsDeviceControl(PDEVICE_OBJECT deviceObject,
NETLINK_FAMILY *nlFamilyOps;
OVS_USER_PARAMS_CONTEXT usrParamsCtx;
+PAGED_CODE();
#ifdef DBG
POVS_DEVICE_EXTENSION ovsExt =
(POVS_DEVICE_EXTENSION)NdisGetDeviceReservedExtension(deviceObject);
diff --git a/datapath-windows/ovsext/Driver.c b/datapath-windows/ovsext/Driver.c
index 80979ea..50c9614 100644
--- a/datapath-windows/ovsext/Driver.c
+++ b/datapath-windows/ovsext/Driver.c
@@ -60,6 +60,8 @@ static const GUID ovsExtGuid = {
{0x8b, 0x47, 0x57, 0x82, 0x97, 0xad, 0x76, 0x23}
};
+DRIVER_INITIALIZE DriverEntry;
+
/* Declarations of callback functions for the filter driver. */
DRIVER_UNLOAD OvsExtUnload;
FILTER_NET_PNP_EVENT OvsExtNetPnPEvent;
@@ -141,6 +143,7 @@ DriverEntry(PDRIVER_OBJECT driverObject,
driverObject->DriverUnload = OvsExtUnload;
+gOvsExtDriverHandle = NULL;
status = NdisFRegisterFilterDriver(driverObject,
(NDIS_HANDLE)gOvsExtDriverObject,
&driverChars,
@@ -152,16 +155,14 @@ DriverEntry(PDRIVER_OBJECT driverObject,
/* Create the communication channel for userspace. */
status = OvsCreateDeviceObject(gOvsExtDriverHandle);
if (status != NDIS_STATUS_SUCCESS) {
+NdisFDeregisterFilterDriver(gOvsExtDriverHandle);
+gOvsExtDriverHandle = NULL;
goto cleanup;
}
cleanup:
if (status != NDIS_STATUS_SUCCESS){
OvsCleanup();
-if (gOvsExtDriverHandle) {
-NdisFDeregisterFilterDriver(gOvsExtDriverHandle);
-gOvsExtDriverHandle = NULL;
-}
}
return status;
--
2.7.2.windows.1
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev