summaryrefslogtreecommitdiff
path: root/ofproto/ofproto.c
diff options
context:
space:
mode:
authorHan Zhou <hzhou8@ebay.com>2018-11-07 22:29:43 -0800
committerBen Pfaff <blp@ovn.org>2018-11-09 13:23:24 -0800
commitf7fc8a30f9fe5f92a8897bc71f64d7c47d298ee1 (patch)
tree0d96899fe2b40587d3d8c4e159e2c520cd1ab5d6 /ofproto/ofproto.c
parent9ce4aa8ee74642dedb4d2b1e7ece99c086d02c37 (diff)
downloadopenvswitch-f7fc8a30f9fe5f92a8897bc71f64d7c47d298ee1.tar.gz
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>
Diffstat (limited to 'ofproto/ofproto.c')
-rw-r--r--ofproto/ofproto.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 222c74994..bb020fee0 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -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);
}