[ovs-dev] [PATCH] dpif-netdev: delete lost packets in dp_execute_cb()
Daniele Di Proietto
ddiproietto at vmware.com
Wed Jun 25 18:39:34 UTC 2014
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 at nicira.com>
Signed-off-by: Daniele Di Proietto <ddiproietto at vmware.com>
---
lib/dpif-netdev.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index e814645..d544cca 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -2221,8 +2221,12 @@ dp_execute_cb(void *aux_, struct dpif_packet **packets, int cnt,
switch ((enum ovs_action_attr)type) {
case OVS_ACTION_ATTR_OUTPUT:
p = dp_netdev_lookup_port(aux->dp, u32_to_odp(nl_attr_get_u32(a)));
- if (p) {
+ if (OVS_LIKELY(p)) {
netdev_send(p->netdev, packets, cnt, may_steal);
+ } else if (may_steal) {
+ for (i = 0; i < cnt; i++) {
+ dpif_packet_delete(packets[i]);
+ }
}
break;
@@ -2311,6 +2315,11 @@ dp_execute_cb(void *aux_, struct dpif_packet **packets, int cnt,
break;
} else {
VLOG_WARN("Packet dropped. Max recirculation depth exceeded.");
+ if (may_steal) {
+ for (i = 0; i < cnt; i++) {
+ dpif_packet_delete(packets[i]);
+ }
+ }
}
break;
--
2.0.0
More information about the dev
mailing list