Fix crash when no actions are specified.
authorJustin Pettit <jpettit@nicira.com>
Sat, 13 Sep 2008 01:47:29 +0000 (18:47 -0700)
committerJustin Pettit <jpettit@nicira.com>
Sat, 13 Sep 2008 01:47:29 +0000 (18:47 -0700)
Actions are allocated as a pointer to an array of actions in flows.  When
flows are freed, the code was always freeing the action pointer.
Under some circumstances the pointer may not be set.

datapath/flow.c
switch/switch-flow.c

index a2c96abd6348a747b9df20fb019716949dd64324..71dd8235df898b5fcb7d16fbd050567bd369e56c 100644 (file)
@@ -187,7 +187,8 @@ void flow_free(struct sw_flow *flow)
 {
        if (unlikely(!flow))
                return;
-       kfree(flow->actions);
+       if (flow->actions)
+               kfree(flow->actions);
        kmem_cache_free(flow_cache, flow);
 }
 EXPORT_SYMBOL(flow_free);
index 9c9538d0eeba5ba0413e7caa3851e00b5caea242..16a7177e1ec124341e4b190adc033f7756642850 100644 (file)
@@ -191,7 +191,9 @@ flow_free(struct sw_flow *flow)
     if (!flow) {
         return; 
     }
-    free(flow->actions);
+    if (flow->actions) {
+        free(flow->actions);
+    }
     free(flow);
 }