From: Andy Zhou <azhou@nicira.com>
Date: Tue, 15 Apr 2014 23:28:15 +0000 (-0700)
Subject: datapath: Fix a double free bug for the sample action
X-Git-Tag: sliver-openvswitch-2.2.90-1~3^2~125
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=40dd413d5b5424eb4cd2e6a8558d33f3b7c607ed;p=sliver-openvswitch.git

datapath: Fix a double free bug for the sample action

When sample action returns with an error, the skb has already been
freed. This patch fix a bug to make sure we don't free it again.
---

diff --git a/datapath/actions.c b/datapath/actions.c
index 0b66e7c6e..82cfd2d50 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -552,6 +552,8 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb,
 
 		case OVS_ACTION_ATTR_SAMPLE:
 			err = sample(dp, skb, a);
+			if (unlikely(err)) /* skb already freed. */
+				return err;
 			break;
 		}