[ovs-dev] [PATCH ovn v2] ovn-controller: Check for NULL before accessing ovsrec_open_vswitch row.

numans at ovn.org numans at ovn.org
Thu Feb 20 14:43:40 UTC 2020


From: Numan Siddique <numans at ovn.org>

There are occasional crashes seen with OpenShift CI

****
gdb) bt
0  hmap_first_with_hash (hmap=0x128, hmap=0x128, hash=2563384147) at include/openvswitch/hmap.h:328
1  smap_find__ (smap=0x128, key=key at entry=0x558de1ab278f "ovn-openflow-probe-interval", key_len=27, hash=2563384147) at lib/smap.c:402
2  0x0000558de19f2596 in smap_get_node (smap=<optimized out>, key=key at entry=0x558de1ab278f "ovn-openflow-probe-interval") at lib/smap.c:217
3  0x0000558de19f26cc in smap_get_def (def=0x0, key=0x558de1ab278f "ovn-openflow-probe-interval", smap=<optimized out>) at lib/smap.c:208
4  smap_get (key=0x558de1ab278f "ovn-openflow-probe-interval", smap=<optimized out>) at lib/smap.c:200
5  smap_get_int (smap=<optimized out>, key=key at entry=0x558de1ab278f "ovn-openflow-probe-interval", def=def at entry=5) at lib/smap.c:240
6  0x0000558de192f1ac in get_ofctrl_probe_interval (ovs_idl=<optimized out>) at controller/ovn-controller.c:439
7  main (argc=12, argv=0x7ffcfaef1e28) at controller/ovn-controller.c:1917

*****

This patch fixes it.

Reported-by: Alexander Constantinescu <aconstan at redhat.com>
Signed-off-by: Numan Siddique <numans at ovn.org>
---
v1 -> v2
-------
  * Fixed the incomplete commit message

 controller/ovn-controller.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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
-- 
2.24.1



More information about the dev mailing list