From: Han Zhou <[email protected]>

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 <[email protected]>
---
 ofproto/ofproto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 222c749..bb020fe 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);
      }
-- 
2.1.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to