Re: [ovs-dev] [PATCH 1/3] datapath-windows: Avoid using uninitialized gOvsExtDriverHandle

2016-04-18 Thread Sorin Vinturis
Acked-by: Sorin Vinturis <svintu...@cloudbasesolutions.com>

-Original Message-
From: dev [mailto:dev-boun...@openvswitch.org] On Behalf Of Paul Boca
Sent: Saturday, 16 April, 2016 00:59
To: dev@openvswitch.org
Subject: [ovs-dev] [PATCH 1/3] 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 <pb...@cloudbasesolutions.com>
---
 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,
, @@ -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
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 1/3] datapath-windows: Avoid using uninitialized gOvsExtDriverHandle

2016-04-15 Thread Paul Boca
Ensure gOvsExtDriverHandle is not used if initialization fails
Added PAGED_CODE() where needed

Signed-off-by: Paul-Daniel Boca 
---
 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,
,
@@ -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