From: Pravin B Shelar <pshelar@nicira.com>
Date: Mon, 21 Jan 2013 07:14:36 +0000 (-0800)
Subject: datapath: Fix Flow dump operation.
X-Git-Tag: sliver-openvswitch-1.9.90-3~8^2~14
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=f6f481ee078d92a51d01cf57d1ca42b6c759cf71;p=sliver-openvswitch.git

datapath: Fix Flow dump operation.

Following patch adds null check while inserting new netlink attribute.
This was introduced by commit 9b405f1aa8d175d (datapath: More
flexible kernel/userspace tunneling attribute.)

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
Bug #14767
---

diff --git a/datapath/datapath.c b/datapath/datapath.c
index b8e9d1889..ed3dd090e 100644
--- a/datapath/datapath.c
+++ b/datapath/datapath.c
@@ -1109,10 +1109,15 @@ static int ovs_flow_cmd_fill_info(struct sw_flow *flow, struct datapath *dp,
 	 * properly sized for single flows.
 	 */
 	start = nla_nest_start(skb, OVS_FLOW_ATTR_ACTIONS);
-	err = actions_to_attr(sf_acts->actions, sf_acts->actions_len, skb);
-	if (err < 0 && skb_orig_len)
+	if (start) {
+		err = actions_to_attr(sf_acts->actions, sf_acts->actions_len, skb);
+		if (err < 0 && skb_orig_len)
+			goto error;
+		nla_nest_end(skb, start);
+	} else if (skb_orig_len) {
+		err = -ENOMEM;
 		goto error;
-	nla_nest_end(skb, start);
+	}
 
 	return genlmsg_end(skb, ovs_header);