summaryrefslogtreecommitdiff
path: root/datapath-windows/ovsext/Driver.c
diff options
context:
space:
mode:
authorPaul Boca <pboca@cloudbasesolutions.com>2016-04-18 08:33:56 +0000
committerBen Pfaff <blp@ovn.org>2016-04-21 11:29:55 -0700
commit12f1ba41a3d321a7cc5c1146a99a1170d55c5189 (patch)
treee9ccaf8bb0c117c61b45f24482b99c2b9b01c0ee /datapath-windows/ovsext/Driver.c
parent110f7c75e567c3af55394dd0a294cc124067115b (diff)
downloadopenvswitch-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>
Diffstat (limited to 'datapath-windows/ovsext/Driver.c')
-rw-r--r--datapath-windows/ovsext/Driver.c9
1 files changed, 5 insertions, 4 deletions
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;