2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-30 13:58:14 +00:00

ofproto.c: Fix port number leaking.

When there is an error in ofport_install(), the ofp port number is
not deallocated, which leads to port number leak. For example,
when there is an redundant tunnel port added in an OVS bridge,
ovs-vswitchd will try to add the port to ofproto whenever OVSDB
changes, which would trigger the port number leak, and over the
time there won't be any port available for valid requests.

Signed-off-by: Han Zhou <hzhou8@ebay.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Han Zhou
2018-11-07 22:29:43 -08:00
committed by Ben Pfaff
parent 9ce4aa8ee7
commit f7fc8a30f9

View File

@@ -2516,6 +2516,7 @@ ofport_destroy__(struct ofport *port)
struct ofproto *ofproto = port->ofproto;
const char *name = netdev_get_name(port->netdev);
dealloc_ofp_port(port->ofproto, port->ofp_port);
hmap_remove(&ofproto->ports, &port->hmap_node);
shash_find_and_delete(&ofproto->port_by_name, name);
@@ -2527,7 +2528,6 @@ static void
ofport_destroy(struct ofport *port, bool del)
{
if (port) {
dealloc_ofp_port(port->ofproto, port->ofp_port);
port->ofproto->ofproto_class->port_destruct(port, del);
ofport_destroy__(port);
}