From patchwork Thu Feb 20 14:43:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1241464 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48NcmD46JZz9sSL for ; Fri, 21 Feb 2020 01:43:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 24E4885F83; Thu, 20 Feb 2020 14:43:55 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id s0UxbCS6laJf; Thu, 20 Feb 2020 14:43:54 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 85F1185F79; Thu, 20 Feb 2020 14:43:54 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 65E32C1D81; Thu, 20 Feb 2020 14:43:54 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id E1B5EC013E for ; Thu, 20 Feb 2020 14:43:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CE47186EC9 for ; Thu, 20 Feb 2020 14:43:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xCmjvp+rYHpe for ; Thu, 20 Feb 2020 14:43:52 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by whitealder.osuosl.org (Postfix) with ESMTPS id B544486E69 for ; Thu, 20 Feb 2020 14:43:51 +0000 (UTC) X-Originating-IP: 115.99.208.110 Received: from nummac.local (unknown [115.99.208.110]) (Authenticated sender: numans@ovn.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 847C21BF20A; Thu, 20 Feb 2020 14:43:47 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Thu, 20 Feb 2020 20:13:40 +0530 Message-Id: <20200220144340.2787935-1-numans@ovn.org> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Cc: Alexander Constantinescu Subject: [ovs-dev] [PATCH ovn v2] ovn-controller: Check for NULL before accessing ovsrec_open_vswitch row. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Numan Siddique 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@entry=0x558de1ab278f "ovn-openflow-probe-interval", key_len=27, hash=2563384147) at lib/smap.c:402 2 0x0000558de19f2596 in smap_get_node (smap=, key=key@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=) at lib/smap.c:208 4 smap_get (key=0x558de1ab278f "ovn-openflow-probe-interval", smap=) at lib/smap.c:200 5 smap_get_int (smap=, key=key@entry=0x558de1ab278f "ovn-openflow-probe-interval", def=def@entry=5) at lib/smap.c:240 6 0x0000558de192f1ac in get_ofctrl_probe_interval (ovs_idl=) 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 Signed-off-by: Numan Siddique Acked-by: Dumitru Ceara --- 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