datapath: Fix a double free bug for the sample action
authorAndy Zhou <azhou@nicira.com>
Tue, 15 Apr 2014 23:28:15 +0000 (16:28 -0700)
committerAndy Zhou <azhou@nicira.com>
Wed, 16 Apr 2014 20:28:15 +0000 (13:28 -0700)
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.

datapath/actions.c

index 0b66e7c..82cfd2d 100644 (file)
@@ -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;
                }