Actions are optional for flow SET.  Previously, we assigned the flow's
actions pointer to NULL in this case, but we never check for the NULL
pointer later on.  This patch modifies this case to allocate a valid
but empty set of actions instead.

Signed-off-by: Jarno Rajahalme <jrajaha...@nicira.com>
---
 datapath/datapath.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/datapath/datapath.c b/datapath/datapath.c
index f496509..58e20be 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -808,7 +808,14 @@ static int ovs_flow_cmd_new_or_set(struct sk_buff *skb, 
struct genl_info *info)
                        OVS_NLERR("Flow actions may not be safe on all matching 
packets.\n");
                        goto err_kfree;
                }
-       } else if (info->genlhdr->cmd == OVS_FLOW_CMD_NEW) {
+       } else if (info->genlhdr->cmd == OVS_FLOW_CMD_SET) {
+               /* Need empty actions. */
+               acts = ovs_nla_alloc_flow_actions(0);
+               error = PTR_ERR(acts);
+               if (IS_ERR(acts))
+                       goto error;
+       } else {
+               /* OVS_FLOW_CMD_NEW must have actions. */
                error = -EINVAL;
                goto error;
        }
-- 
1.7.10.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to