connmgr_wants_packet_in_on_miss would be invoked in the handler threads,
while ofconn in mgr->all_conns may be destroyed in the main thread. So
we should acquire ofproto_mutex to prevent us from using ofconn which
has been freed.
---
ofproto/connmgr.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/ofproto/connmgr.c b/ofproto/connmgr.c
index 80b0f6d..01cdf50 100644
--- a/ofproto/connmgr.c
+++ b/ofproto/connmgr.c
@@ -1509,15 +1509,18 @@ connmgr_wants_packet_in_on_miss(struct connmgr *mgr)
{
struct ofconn *ofconn;
+ ovs_mutex_lock(&ofproto_mutex);
LIST_FOR_EACH (ofconn, node, &mgr->all_conns) {
enum ofputil_protocol protocol = ofconn_get_protocol(ofconn);
if (ofconn->controller_id == 0 &&
(protocol == OFPUTIL_P_NONE ||
ofputil_protocol_to_ofp_version(protocol) < OFP13_VERSION)) {
+ ovs_mutex_unlock(&ofproto_mutex);
return true;
}
}
+ ovs_mutex_unlock(&ofproto_mutex);
return false;
}
--
2.0.3
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev