[ovs-dev,ovn] ovn-controller: Check for NULL before accessing ovsrec_open_vswitch row.
diff mbox series

Message ID 20200220144109.2787454-1-numans@ovn.org
State Superseded
Headers show
Series
  • [ovs-dev,ovn] ovn-controller: Check for NULL before accessing ovsrec_open_vswitch row.
Related show

Commit Message

Numan Siddique Feb. 20, 2020, 2:41 p.m. UTC
From: Numan Siddique <numans@ovn.org>

There are occasional crashes seen with OpenShift CI

****
gdb) bt
*****

This patch fixes it.

Reported-by: Alexander Constantinescu <aconstan@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
 controller/ovn-controller.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Patch
diff mbox series

diff --git a/controller/ovn-controller.c b/controller/ovn-controller.c
index 4d245ca28..386c9f006 100644
--- a/controller/ovn-controller.c
+++ b/controller/ovn-controller.c
@@ -436,9 +436,10 @@  static int
 get_ofctrl_probe_interval(struct ovsdb_idl *ovs_idl)
 {
     const struct ovsrec_open_vswitch *cfg = ovsrec_open_vswitch_first(ovs_idl);
-    return smap_get_int(&cfg->external_ids,
-                        "ovn-openflow-probe-interval",
-                        OFCTRL_DEFAULT_PROBE_INTERVAL_SEC);
+    return !cfg ? OFCTRL_DEFAULT_PROBE_INTERVAL_SEC :
+                  smap_get_int(&cfg->external_ids,
+                               "ovn-openflow-probe-interval",
+                               OFCTRL_DEFAULT_PROBE_INTERVAL_SEC);
 }
 
 /* Retrieves the pointer to the OVN Southbound database from 'ovs_idl' and