- #3102 introduce remote adest list which refer svc_cnt to start/stop
or delete adest from list. But in tcp transport, svc down may come twice
then svc_cnt is updated incorrectly. Later cause crash inside function
stop_mds_down_tmr().
- check svc_cnt greater than zero before decrease it then no crash as
consequence of this wrong counter.
---
 src/mds/mds_c_api.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/mds/mds_c_api.c b/src/mds/mds_c_api.c
index a76b2b76a..f762a0f9b 100644
--- a/src/mds/mds_c_api.c
+++ b/src/mds/mds_c_api.c
@@ -3662,14 +3662,16 @@ uint32_t mds_mcm_svc_down(PW_ENV_ID pwe_id, MDS_SVC_ID 
svc_id, V_DEST_RL role,
                                &gl_mds_mcm_cb->adest_list,
                                (uint8_t *)&adest);
                if (adest_info) {
-                       adest_info->svc_cnt--;
-                       if (adest_info->svc_cnt == 0) {
-                               m_MDS_LOG_INFO(
-                                   "MCM:API: Adest <0x%08x, %u>"
-                                   " down timer start",
-                                   m_MDS_GET_NODE_ID_FROM_ADEST(adest),
-                                   m_MDS_GET_PROCESS_ID_FROM_ADEST(adest));
-                               start_mds_down_tmr(adest, 0);
+                       if (adest_info->svc_cnt > 0) {
+                               adest_info->svc_cnt--;
+                               if (adest_info->svc_cnt == 0) {
+                                       m_MDS_LOG_INFO(
+                                           "MCM:API: Adest <0x%08x, %u>"
+                                           " down timer start",
+                                           m_MDS_GET_NODE_ID_FROM_ADEST(adest),
+                                           
m_MDS_GET_PROCESS_ID_FROM_ADEST(adest));
+                                       start_mds_down_tmr(adest, 0);
+                               }
                        }
                }
 
-- 
2.17.1



_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to