mirror of
https://github.com/openvswitch/ovs
synced 2025-10-11 13:57:52 +00:00
dpif-netdev: Fix memory leak in tunnel header pop action.
The tunnel header pop action can leak batch of packet in case of error. Following patch fixex the error code path. Signed-off-by: Pravin B Shelar <pshelar@ovn.org> Acked-by: Jesse Gross <jesse@kernel.org>
This commit is contained in:
@@ -3751,30 +3751,25 @@ dp_execute_cb(void *aux_, struct dp_packet_batch *packets_,
|
||||
p = dp_netdev_lookup_port(dp, portno);
|
||||
if (p) {
|
||||
struct dp_packet_batch tnl_pkt;
|
||||
int err;
|
||||
int i;
|
||||
|
||||
if (!may_steal) {
|
||||
dp_packet_batch_clone(&tnl_pkt, packets_);
|
||||
packets_ = &tnl_pkt;
|
||||
}
|
||||
|
||||
err = netdev_pop_header(p->netdev, packets_);
|
||||
netdev_pop_header(p->netdev, packets_);
|
||||
if (!packets_->count) {
|
||||
return;
|
||||
}
|
||||
if (!err) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < packets_->count; i++) {
|
||||
packets_->packets[i]->md.in_port.odp_port = portno;
|
||||
}
|
||||
|
||||
(*depth)++;
|
||||
dp_netdev_recirculate(pmd, packets_);
|
||||
(*depth)--;
|
||||
} else {
|
||||
dp_packet_delete_batch(&tnl_pkt, !may_steal);
|
||||
for (i = 0; i < packets_->count; i++) {
|
||||
packets_->packets[i]->md.in_port.odp_port = portno;
|
||||
}
|
||||
|
||||
(*depth)++;
|
||||
dp_netdev_recirculate(pmd, packets_);
|
||||
(*depth)--;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user