From 80621ce3c5da5062f7e3efb42d6e8fcdd9caa3f6 Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Mon, 8 Jun 2015 11:09:57 -0400 Subject: Fix unsafe uses of ast_context pointers. Although ast_context_find, ast_context_find_or_create and ast_context_destroy perform locking of the contexts table, any context pointer can become invalid at any time that the contexts table is unlocked. This change adds locking around all complete operations involving these functions. Places where ast_context_find was followed by ast_context_destroy have been replaced with calls ast_context_destroy_by_name. ASTERISK-25094 #close Reported by: Corey Farrell Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa --- channels/chan_iax2.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'channels/chan_iax2.c') diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index dbad79dcc..c797b8750 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -14626,7 +14626,6 @@ static void cleanup_thread_list(void *head) static int __unload_module(void) { - struct ast_context *con; int x; network_change_stasis_unsubscribe(); @@ -14703,9 +14702,7 @@ static int __unload_module(void) sched = NULL; ao2_ref(peercnts, -1); - con = ast_context_find(regcontext); - if (con) - ast_context_destroy(con, "IAX2"); + ast_context_destroy_by_name(regcontext, "IAX2"); ast_unload_realtime("iaxpeers"); ao2_ref(iax2_tech.capabilities, -1); -- cgit v1.2.3