mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 10:47:18 +00:00 
			
		
		
		
	Fix deadlock when using dummy channels.
Dummy channels created by ast_dummy_channel_alloc() should be destoyed by
ast_channel_unref().  Using ast_channel_release() needlessly grabs the
channel container lock and can cause a deadlock as a result.
* Analyzed use of ast_dummy_channel_alloc() and made use
ast_channel_unref() when done with the dummy channel.  (Primary reason for
the reported deadlock.)
* Made app_dial.c:dial_exec_full() not call ast_call() holding any channel
locks.  Chan_local could not perform deadlock avoidance correctly.
(Potential deadlock exposed by this issue.  Secondary reason for the
reported deadlock since the held lock was part of the deadlock chain.)
* Fixed some uses of ast_dummy_channel_alloc() not checking the returned
channel pointer for failure.
* Fixed some potential chan=NULL pointer usage in func_odbc.c.  Protected
by testing the bogus_chan value.
* Fixed needlessly clearing a 1024 char auto array when setting the first
char to zero is enough in manager.c:action_getvar().
(closes issue ASTERISK-18613)
Reported by: Thomas Arimont
Patches:
      jira_asterisk_18613_v1.8.patch (license #5621) patch uploaded by rmudgett
Tested by: Thomas Arimont
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@337973 65c4cc65-6c06-0410-ace0-fbb531ad65f3
			
			
This commit is contained in:
		| @@ -3078,7 +3078,7 @@ static int action_getvar(struct mansession *s, const struct message *m) | ||||
| 	const char *name = astman_get_header(m, "Channel"); | ||||
| 	const char *varname = astman_get_header(m, "Variable"); | ||||
| 	char *varval; | ||||
| 	char workspace[1024] = ""; | ||||
| 	char workspace[1024]; | ||||
|  | ||||
| 	if (ast_strlen_zero(varname)) { | ||||
| 		astman_send_error(s, m, "No variable specified"); | ||||
| @@ -3092,12 +3092,12 @@ static int action_getvar(struct mansession *s, const struct message *m) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	workspace[0] = '\0'; | ||||
| 	if (varname[strlen(varname) - 1] == ')') { | ||||
| 		if (!c) { | ||||
| 			c = ast_dummy_channel_alloc(); | ||||
| 			if (c) { | ||||
| 				ast_func_read(c, (char *) varname, workspace, sizeof(workspace)); | ||||
| 				c = ast_channel_release(c); | ||||
| 			} else | ||||
| 				ast_log(LOG_ERROR, "Unable to allocate bogus channel for variable substitution.  Function results may be blank.\n"); | ||||
| 		} else { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user