[ovs-dev] [PATCH] odp-execute: Fix possible segfault.

Alex Wang alexw at nicira.com
Sat Oct 19 00:27:51 UTC 2013


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 at nicira.com>
---
 lib/odp-execute.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 185cf31..19fcc1c 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -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;
         }
 
-- 
1.7.9.5




More information about the dev mailing list