From: Joonghwan Lee Date: Thu, 19 Jan 2017 08:33:20 +0000 (+0900) Subject: Fix crash in ssl retransmission thread X-Git-Tag: accepted/tizen/3.0/common/20171127.084406 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Ftags%2Faccepted%2Ftizen%2F3.0%2Fcommon%2F20171127.084406;p=platform%2Fupstream%2Fiotivity.git Fix crash in ssl retransmission thread It is possible to happen segmentation fault if retransmission thread lock a mutex during CAdeinitSslAdapter function is called Patch 1: Initial upload Change-Id: I446aeb2cc9d6cd07d2683984ba2783ab72020c58 Signed-off-by: Joonghwan Lee Reviewed-on: https://gerrit.iotivity.org/gerrit/16575 Tested-by: jenkins-iotivity Reviewed-by: Randeep Singh --- diff --git a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c index b490c8a..d0f44bd 100644 --- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c +++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c @@ -1214,6 +1214,7 @@ static void StopRetransmit() if (g_caSslContext) { unregisterTimer(g_caSslContext->timerId); + g_caSslContext->timerId= -1; } } #endif @@ -1292,12 +1293,14 @@ static int StartRetransmit() uint32_t listIndex = 0; uint32_t listLength = 0; SslEndPoint_t *tep = NULL; + + ca_mutex_lock(g_sslContextMutex); if (NULL == g_caSslContext) { OIC_LOG(ERROR, NET_SSL_TAG, "Context is NULL. Stop retransmission"); + ca_mutex_unlock(g_sslContextMutex); return -1; } - ca_mutex_lock(g_sslContextMutex); if (g_caSslContext->timerId != -1) { //clear previous timer