2
0
mirror of https://github.com/openvswitch/ovs synced 2025-09-01 14:55:18 +00:00

dpif-netdev: delete lost packets in dp_execute_cb()

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>
This commit is contained in:
Daniele Di Proietto
2014-06-25 11:39:34 -07:00
committed by Pravin B Shelar
parent 5c75f4beed
commit 26a5075bb6

View File

@@ -2231,8 +2231,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;
@@ -2321,6 +2325,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;