odp-execute: Fix possible segfault.
authorAlex Wang <alexw@nicira.com>
Sat, 19 Oct 2013 00:27:51 +0000 (17:27 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 21 Oct 2013 22:54:19 +0000 (15:54 -0700)
In current code, the odp_execute_actions() function does not check
the value of "userspace" function pointer before invoking it.  This
patch adds a check for it.

Signed-off-by: Alex Wang <alexw@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/odp-execute.c

index 185cf31..19fcc1c 100644 (file)
@@ -200,7 +200,9 @@ odp_execute_actions(void *dp, struct ofpbuf *packet, struct flow *key,
             break;
 
         case OVS_ACTION_ATTR_USERSPACE: {
-            userspace(dp, packet, key, a);
+            if (userspace) {
+                userspace(dp, packet, key, a);
+            }
             break;
         }