Do not call pthread_cancel in notification manager 79/149979/1 accepted/tizen/unified/20170920.081248 submit/tizen/20170918.114609
authorSemun Lee <semun.lee@samsung.com>
Thu, 14 Sep 2017 01:24:21 +0000 (10:24 +0900)
committerSemun Lee <semun.lee@samsung.com>
Thu, 14 Sep 2017 01:24:21 +0000 (10:24 +0900)
pthread_cancel may lead unpredictable thread synchronization problem
when it is not used properly.
pthread_cancel in notification manager may lead deadlock because
it terminates __dp_notification_manager thread asynchronously.

refer to https://www.securecoding.cert.org/confluence/display/c/POS47-C.+Do+not+use+threads+that+can+be+canceled+asynchronously

Change-Id: I39c00a882df5cfede647e0d456c03eeb57c8971e
Signed-off-by: Semun Lee <semun.lee@samsung.com>
provider/download-provider-notification-manager.c

index d2c7802..57164fd 100644 (file)
@@ -547,7 +547,6 @@ void dp_notification_manager_kill()
                g_dp_notification_manager_tid = 0;
                pthread_cond_signal(&g_dp_notification_manager_cond);
                CLIENT_MUTEX_UNLOCK(&g_dp_notification_manager_mutex);
-               pthread_cancel(tid);
                pthread_join(tid, (void **)&status);
        }
 }