diff options
author | Paul Boca <pboca@cloudbasesolutions.com> | 2016-04-18 08:33:56 +0000 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-04-21 11:29:55 -0700 |
commit | 12f1ba41a3d321a7cc5c1146a99a1170d55c5189 (patch) | |
tree | e9ccaf8bb0c117c61b45f24482b99c2b9b01c0ee | |
parent | 110f7c75e567c3af55394dd0a294cc124067115b (diff) | |
download | openvswitch-12f1ba41a3d321a7cc5c1146a99a1170d55c5189.tar.gz |
datapath-windows: Avoid using uninitialized gOvsExtDriverHandle
Ensure gOvsExtDriverHandle is not used if initialization fails
Added PAGED_CODE() where needed
Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
Acked-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
-rw-r--r-- | datapath-windows/ovsext/Datapath.c | 4 | ||||
-rw-r--r-- | 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 0a25af04d..06f99b3d7 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 80979ea61..50c9614e4 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; |