It's unsafe to hold a pointer to a row in the IDL across calls to
ovsdb_idl_run() for that IDL.

Signed-off-by: Ben Pfaff <b...@nicira.com>
Acked-by: Russell Bryant <rbry...@redhat.com>
---
v1->v2: Call ovsdb_idl_run() before instead of after accessing IDL.
---
 ovn/controller/ovn-controller.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index fda1534..bd3ef0d 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -95,21 +95,20 @@ get_bridge(struct controller_ctx *ctx, const char *name)
 static void
 get_core_config(struct controller_ctx *ctx)
 {
-    const struct ovsrec_open_vswitch *cfg;
+    while (1) {
+        ovsdb_idl_run(ctx->ovs_idl);
 
-    cfg = ovsrec_open_vswitch_first(ctx->ovs_idl);
-    if (!cfg) {
-        VLOG_ERR("No Open_vSwitch row defined.");
-        ovsdb_idl_destroy(ctx->ovs_idl);
-        exit(EXIT_FAILURE);
-    }
+        const struct ovsrec_open_vswitch *cfg;
+        cfg = ovsrec_open_vswitch_first(ctx->ovs_idl);
+        if (!cfg) {
+            VLOG_ERR("No Open_vSwitch row defined.");
+            ovsdb_idl_destroy(ctx->ovs_idl);
+            exit(EXIT_FAILURE);
+        }
 
-    while (1) {
         const struct ovsrec_bridge *br_int;
         const char *remote, *system_id, *br_int_name;
 
-        ovsdb_idl_run(ctx->ovs_idl);
-
         br_int_name = smap_get(&cfg->external_ids, "ovn-bridge");
         if (!br_int_name) {
             br_int_name = DEFAULT_BRIDGE_NAME;
-- 
2.1.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to