dpif-netdev: delete lost packets in dp_execute_cb()
authorDaniele Di Proietto <ddiproietto@vmware.com>
Wed, 25 Jun 2014 20:39:45 +0000 (13:39 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Wed, 25 Jun 2014 21:50:49 +0000 (14:50 -0700)
This commit fixes memory leaks in dp_execute_cb() in two cases:
    - when the output port cannot be found
    - when the recirculation depth is exceeded

Reported-by: Pravin Shelar <pshelar@nicira.com>
Signed-off-by: Daniele Di Proietto <ddiproietto@vmware.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/dpif-netdev.c

index 9edbe4c..fdf1af4 100644 (file)
@@ -2114,7 +2114,10 @@ dp_execute_cb(void *aux_, struct ofpbuf *packet,
         p = dp_netdev_lookup_port(aux->dp, u32_to_odp(nl_attr_get_u32(a)));
         if (p) {
             netdev_send(p->netdev, packet, may_steal);
+        } else if (may_steal) {
+            ofpbuf_delete(packet);
         }
+
         break;
 
     case OVS_ACTION_ATTR_USERSPACE: {
@@ -2170,6 +2173,9 @@ dp_execute_cb(void *aux_, struct ofpbuf *packet,
 
             break;
         } else {
+            if (may_steal) {
+                ofpbuf_delete(packet);
+            }
             VLOG_WARN("Packet dropped. Max recirculation depth exceeded.");
         }
         break;