[ovs-dev] [PATCH v3 01/10] datapath: Avoid assigning a NULL pointer to flow actions.

Jarno Rajahalme jrajahalme at nicira.com
Fri Feb 21 19:41:11 UTC 2014


Flow SET can set an empty set of actions by not passing any actions.
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.

Note: If might be prudent to allow missing actions also in
OVS_FLOW_CMD_NEW.

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

diff --git a/datapath/datapath.c b/datapath/datapath.c
index f7c3391..130300f 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -810,7 +810,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




More information about the dev mailing list