Gentle reminder for review!/Thanks Hans

-----Original Message-----
From: Hans Nordeback [mailto:[email protected]] 
Sent: den 15 april 2016 10:26
To: [email protected]; [email protected]; Gary Lee
Cc: [email protected]
Subject: [devel] [PATCH 1 of 1] amfd: Segv in ng_ccb_completed_delete_hdlr 
[#1766]

 osaf/services/saf/amf/amfd/nodegroup.cc |  10 ++++++++++
 osaf/services/saf/amf/amfd/su.cc        |  12 +++++++++++-
 2 files changed, 21 insertions(+), 1 deletions(-)


When running SMF tests that creates and deletes nodegrups, the nodegroup_db 
sometimes do not contain the nodegroup given in parameter opdata->objectName.

diff --git a/osaf/services/saf/amf/amfd/nodegroup.cc 
b/osaf/services/saf/amf/amfd/nodegroup.cc
--- a/osaf/services/saf/amf/amfd/nodegroup.cc
+++ b/osaf/services/saf/amf/amfd/nodegroup.cc
@@ -453,6 +453,11 @@ static SaAisErrorT ng_ccb_completed_dele
        AVD_AVND *node;
        AVD_AMF_NG *ng = avd_ng_get(&opdata->objectName);
 
+        if (ng == nullptr) {
+          LOG_WA("Could not find %s in nodegroup_db", 
opdata->objectName.value);
+          return SA_AIS_OK;
+        }
+
        TRACE_ENTER2("%u", ng->number_nodes());
        std::set<std::string>::const_iterator iter;
        if ((ng->saAmfNGAdminState != SA_AMF_ADMIN_LOCKED) && @@ -579,6 +584,11 
@@ static void ng_ccb_apply_delete_hdlr(Ccb  {
        TRACE_ENTER();
        AVD_AMF_NG *ng = avd_ng_get(&opdata->objectName);
+       if (ng == nullptr) {
+               LOG_WA("Could not find %s in nodegroup_db", 
opdata->objectName.value);
+               return;
+       }
+
        SaAmfAdminStateT old_admin_state = ng->saAmfNGAdminState;
        if (avd_cb->avail_state_avd != SA_AMF_HA_ACTIVE) {
                //Since AMF will delete NG, clear its pointers in node.
diff --git a/osaf/services/saf/amf/amfd/su.cc b/osaf/services/saf/amf/amfd/su.cc
--- a/osaf/services/saf/amf/amfd/su.cc
+++ b/osaf/services/saf/amf/amfd/su.cc
@@ -457,6 +457,10 @@ static AVD_AVND *map_su_to_node(AVD_SU *
        /* If node is configured in SU we are done */
        if (strstr((char *)su->saAmfSUHostNodeOrNodeGroup.value, "safAmfNode=") 
!= nullptr) {
                node = avd_node_get(&su->saAmfSUHostNodeOrNodeGroup);
+               if (node == nullptr) {
+                       LOG_WA("Could not find: %s in su: %s", 
su->saAmfSUHostNodeOrNodeGroup.value, su->name.value);
+                       return node;
+               }
                goto done;
        }
 
@@ -495,7 +499,13 @@ static AVD_AVND *map_su_to_node(AVD_SU *
        }
 
        /* All nodes already have an SU mapped for the SG. Return a node in the 
node group. */
-       node = avd_node_get(*ng->saAmfNGNodeList.begin());
+        node_iter = ng->saAmfNGNodeList.begin();
+        if (node_iter != ng->saAmfNGNodeList.end()) {
+               node = avd_node_get(*ng->saAmfNGNodeList.begin());
+        } else {
+               LOG_WA("%s is empty", su->saAmfSUHostNodeOrNodeGroup.value);
+               return nullptr;
+       }
 done:
        memcpy(&su->saAmfSUHostedByNode, &node->name, sizeof(SaNameT));
        TRACE_LEAVE2("hosted by %s", node->name.value);

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager 
Applications Manager provides deep performance insights into multiple tiers of 
your business applications. It resolves application problems quickly and 
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to