wdp-xflow: Copy client_data from old rule to new rule when displacing a rule.
authorBen Pfaff <blp@nicira.com>
Fri, 14 May 2010 22:01:06 +0000 (15:01 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 14 May 2010 22:01:06 +0000 (15:01 -0700)
If client_data is not copied when a new rule displaces an old one, then
the old rule's client data will be leaked and the new rule will have a null
pointer.  This causes a segfault with, e.g.:

    ovs-ofctl add-flow br0 "dl_type=0x800,nw_dst=10.245.7.0/16,actions=output:148"
    ovs-ofctl mod-flows --strict br0 "dl_type=0x800,nw_dst=10.245.7.0/16,actions=output:149"
    ovs-ofctl del-flows --strict br0 "dl_type=0x800,nw_dst=10.245.7.0/16"

Reported by partner.

ofproto/wdp-xflow.c

index 1c5fb92..4a7154b 100644 (file)
@@ -447,6 +447,7 @@ wx_rule_insert(struct wx *wx, struct wx_rule *rule, struct ofpbuf *packet,
 
     /* Free the rule that was displaced, if any. */
     if (displaced_rule) {
+        rule->wr.client_data = displaced_rule->wr.client_data;
         wx_rule_destroy(wx, displaced_rule);
     }
 }