On 9 August 2017 at 17:18, Joe Stringer <j...@ovn.org> wrote: > Previously, netdev_ports_insert() would allocate and insert an > ifindex->odp_port mapping, but netdev_ports_remove() would never remove > the mapping or free the mapping structure. This patch fixes these up. > > Fixes: 32b77c316d9982("dpif: Save added ports in a port map.") > Reported-by: Andy Zhou <az...@ovn.org> > Signed-off-by: Joe Stringer <j...@ovn.org> > Acked-by: Andy Zhou <az...@ovn.org> > ---
Andy gave me an offline review of this, so I applied this incremental and pushed the patch to master and branch-2.8: diff --git a/lib/netdev.c b/lib/netdev.c index 3cf9117b3683..b4e570bafd08 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -2272,12 +2272,13 @@ netdev_ports_remove(odp_port_t port_no, const struct dpif_class *dpif_class) struct ifindex_to_port_data *ifidx = NULL; HMAP_FOR_EACH_WITH_HASH (ifidx, node, ifindex, &ifindex_to_port) { - if (ifidx && ifidx->port == port_no) { + if (ifidx->port == port_no) { hmap_remove(&ifindex_to_port, &ifidx->node); + free(ifidx); break; } } - free(ifidx); + ovs_assert(ifidx); } else { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev