From: l00397770 <lidej...@huawei.com>

When creating a port using ovs-vsctl, its Openflow port number is automatically
assigned, and the max value is 32767. After adding 32767 ports, subsequent 
ports'
number are all 65535, and they are all inserted into a bridge's ifaces hmap,
but when these ports are deleted, their hamp_nodes are not removed by 
iface_destroy__,
this can cause ovs crash in the following call path:
bridge_reconfigure ---> bridge_add_ports ---> bridge_add_ports__ ---> 
iface_create
---> hmap_insert_at ---> hmap_expand_at ---> resize ---> hmap_insert_fast,
the bridge's ifaces hmap bucket is corrupted.

To fix the above issue, we check Openflow port number in iface_do_create: if 
the port
number is 65535, report an error and do not add this port into a bridge.
---
 vswitchd/bridge.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c
index d90997e..6f6314c 100644
--- a/vswitchd/bridge.c
+++ b/vswitchd/bridge.c
@@ -1802,6 +1802,11 @@ iface_do_create(const struct bridge *br,
                       iface_cfg->name, ovs_strerror(error));
         goto error;
     }
+    if (*ofp_portp == OFPP_NONE) {
+        VLOG_WARN("could not add network device %s to ofproto", 
iface_cfg->name);
+        error = ERANGE;
+        goto error;
+    }
 
     VLOG_INFO("bridge %s: added interface %s on port %d",
               br->name, iface_cfg->name, *ofp_portp);
-- 
2.6.4.windows.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to