diff mbox series

[ovs-dev,v1] conntrack: Expand 'conn_to_ct_dpif_entry()'locking.

Message ID 1557759068-88671-1-git-send-email-dlu998@gmail.com
State Superseded
Headers show
Series [ovs-dev,v1] conntrack: Expand 'conn_to_ct_dpif_entry()'locking. | expand

Commit Message

Darrell Ball May 13, 2019, 2:51 p.m. UTC
When displaying a connection entry, several TCP fields are read
from a connection entry. Hence, expand the 'conn' locking so the display
does not potentially include fields values from two different aggregate
states.

Fixes: 967bb5c5cd90 ("conntrack: Add rcu support.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
---
 lib/conntrack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 6711f5e..e5dff75 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -2260,13 +2260,13 @@  conn_to_ct_dpif_entry(const struct conn *conn, struct ct_dpif_entry *entry,
 
     ovs_mutex_lock(&conn->lock);
     long long expiration = conn->expiration - now;
-    ovs_mutex_unlock(&conn->lock);
     entry->timeout = (expiration > 0) ? expiration / 1000 : 0;
 
     struct ct_l4_proto *class = l4_protos[conn->key.nw_proto];
     if (class->conn_get_protoinfo) {
         class->conn_get_protoinfo(conn, &entry->protoinfo);
     }
+    ovs_mutex_unlock(&conn->lock);
 
     entry->bkt = bkt;