Coverity reported an issue where the oftable->vacancy_up/down members were read without holding the ofproto_mutex.
This patch ensures the mutex is acquired before accessing these members and adds OVS_REQUIRES(ofproto_mutex) to the affected function to enforce proper locking. Signed-off-by: Eelco Chaudron <echau...@redhat.com> Fixes: bab86012066c ("Implement Vacancy Events for OFPMP_TABLE_DESC.") --- ofproto/ofproto.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 8fa70e518..6fa18228b 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -4265,6 +4265,7 @@ oftable_vacancy(const struct oftable *t) static void query_table_desc__(struct ofputil_table_desc *td, struct ofproto *ofproto, uint8_t table_id) + OVS_REQUIRES(ofproto_mutex) { const struct oftable *t = &ofproto->tables[table_id]; @@ -4289,10 +4290,12 @@ query_tables_desc(struct ofproto *ofproto, struct ofputil_table_desc **descp) size_t i; table_desc = *descp = xcalloc(ofproto->n_tables, sizeof *table_desc); + ovs_mutex_lock(&ofproto_mutex); for (i = 0; i < ofproto->n_tables; i++) { struct ofputil_table_desc *td = &table_desc[i]; query_table_desc__(td, ofproto, i); } + ovs_mutex_unlock(&ofproto_mutex); } /* Function to handle dump-table-desc request. */ @@ -4325,6 +4328,7 @@ handle_table_desc_request(struct ofconn *ofconn, * must be enabled. */ static void send_table_status(struct ofproto *ofproto, uint8_t table_id) + OVS_REQUIRES(ofproto_mutex) { struct oftable *t = &ofproto->tables[table_id]; if (!t->vacancy_event) { -- 2.50.1 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev