Following patch fixes memory leak in case there is ODP_FIT_ERROR
on flow key.
---
 ofproto/ofproto-dpif.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c
index 14b5447..aabe064 100644
--- a/ofproto/ofproto-dpif.c
+++ b/ofproto/ofproto-dpif.c
@@ -2573,6 +2573,7 @@ handle_miss_upcalls(struct ofproto_dpif *ofproto, struct 
dpif_upcall *upcalls,
                                                 upcall->key, upcall->key_len,
                                                 &flow, &initial_tci);
         if (fitness == ODP_FIT_ERROR) {
+            ofpbuf_delete(upcall->packet);
             continue;
         }
         flow_extract(upcall->packet, flow.priority, flow.tun_id,
@@ -2649,6 +2650,7 @@ handle_userspace_upcall(struct ofproto_dpif *ofproto,
                                             upcall->key_len, &flow,
                                             &initial_tci);
     if (fitness == ODP_FIT_ERROR) {
+        ofpbuf_delete(upcall->packet);
         return;
     }
 
@@ -2664,6 +2666,7 @@ handle_userspace_upcall(struct ofproto_dpif *ofproto,
                               &flow, false);
     } else {
         VLOG_WARN_RL(&rl, "invalid user cookie : 0x%"PRIx64, upcall->userdata);
+        ofpbuf_delete(upcall->packet);
     }
 }
 
@@ -2788,6 +2791,14 @@ update_stats(struct ofproto_dpif *p)
 
         fitness = odp_flow_key_to_flow(key, key_len, &flow);
         if (fitness == ODP_FIT_ERROR) {
+            struct ds s;
+
+            ds_init(&s);
+            odp_flow_key_format(key, key_len, &s);
+            VLOG_ERR_RL(&rl, "unexpected flow from datapath %s", ds_cstr(&s));
+            ds_destroy(&s);
+
+            dpif_flow_del(p->dpif, key, key_len, NULL);
             continue;
         }
 
-- 
1.7.1

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to