datapath-windows: Added specific pool tag for event code
authorSorin Vinturis <svinturis@cloudbasesolutions.com>
Thu, 26 Mar 2015 19:59:36 +0000 (19:59 +0000)
committerBen Pfaff <blp@nicira.com>
Thu, 26 Mar 2015 21:18:46 +0000 (14:18 -0700)
All memory allocations within event code have 'ESVO' pool tag.

Signed-off-by: Sorin Vinturis <svinturis@cloudbasesolutions.com>
Reported-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Reported-at: https://github.com/openvswitch/ovs-issues/issues/56
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Eitan Eliahu <eliahue@vmware.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
datapath-windows/ovsext/Event.c
datapath-windows/ovsext/Util.h

index 00f4616..cca9575 100644 (file)
@@ -96,9 +96,9 @@ OvsCleanupEvent(POVS_OPEN_INSTANCE instance)
 
         LIST_FORALL_SAFE(&queue->elemList, link, next) {
             elem = CONTAINING_RECORD(link, OVS_EVENT_QUEUE_ELEM, link);
-            OvsFreeMemory(elem);
+            OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
         }
-        OvsFreeMemory(queue);
+        OvsFreeMemoryWithTag(queue, OVS_EVENT_POOL_TAG);
     }
 }
 
@@ -139,7 +139,8 @@ OvsPostEvent(UINT32 portNo,
             portNo == OVS_DEFAULT_PORT_NO) {
             queue->pollAll = TRUE;
         } else {
-            elem = (POVS_EVENT_QUEUE_ELEM)OvsAllocateMemory(sizeof(*elem));
+            elem = (POVS_EVENT_QUEUE_ELEM)OvsAllocateMemoryWithTag(
+                sizeof(*elem), OVS_EVENT_POOL_TAG);
             if (elem == NULL) {
                 queue->pollAll = TRUE;
             } else {
@@ -158,7 +159,7 @@ OvsPostEvent(UINT32 portNo,
             LIST_FORALL_SAFE(&queue->elemList, curr, next) {
                 RemoveEntryList(curr);
                 elem = CONTAINING_RECORD(curr, OVS_EVENT_QUEUE_ELEM, link);
-                OvsFreeMemory(elem);
+                OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
             }
             queue->numElems = 0;
         }
@@ -243,7 +244,8 @@ OvsSubscribeEventIoctl(PFILE_OBJECT fileObject,
     }
 
     if (request->subscribe) {
-        queue = (POVS_EVENT_QUEUE)OvsAllocateMemory(sizeof (OVS_EVENT_QUEUE));
+        queue = (POVS_EVENT_QUEUE)OvsAllocateMemoryWithTag(
+            sizeof(OVS_EVENT_QUEUE), OVS_EVENT_POOL_TAG);
         if (queue == NULL) {
             status = STATUS_NO_MEMORY;
             OVS_LOG_WARN("Fail to allocate event queue");
@@ -284,9 +286,9 @@ done_event_subscribe:
         }
         LIST_FORALL_SAFE(&queue->elemList, link, next) {
             elem = CONTAINING_RECORD(link, OVS_EVENT_QUEUE_ELEM, link);
-            OvsFreeMemory(elem);
+            OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
         }
-        OvsFreeMemory(queue);
+        OvsFreeMemoryWithTag(queue, OVS_EVENT_POOL_TAG);
     } else {
         OvsReleaseEventQueueLock();
     }
@@ -446,7 +448,7 @@ OvsRemoveEventEntry(POVS_OPEN_INSTANCE instance,
         elem = (POVS_EVENT_QUEUE_ELEM)RemoveHeadList(&queue->elemList);
         entry->portNo = elem->portNo;
         entry->status = elem->status;
-        OvsFreeMemory(elem);
+        OvsFreeMemoryWithTag(elem, OVS_EVENT_POOL_TAG);
         queue->numElems--;
         status = STATUS_SUCCESS;
     }
index 6a9c169..7811288 100644 (file)
@@ -25,6 +25,7 @@
 #define OVS_OTHER_POOL_TAG              'MSVO'
 #define OVS_MDL_POOL_TAG                'BSVO'
 #define OVS_DATAPATH_POOL_TAG           'DSVO'
+#define OVS_EVENT_POOL_TAG              'ESVO'
 
 VOID *OvsAllocateMemory(size_t size);
 VOID *OvsAllocateMemoryWithTag(size_t size, ULONG tag);