[Asterisk-code-review] channel: Fix some more unprotected channel flag setting. (asterisk[master])

Jenkins2 asteriskteam at digium.com
Wed Jun 20 05:57:24 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/9194 )

Change subject: channel: Fix some more unprotected channel flag setting.
......................................................................

channel: Fix some more unprotected channel flag setting.

Change-Id: I34c3b1201b1de539945bcfdcb264fff30332d48c
---
M channels/chan_dahdi.c
M channels/sig_analog.c
M main/channel.c
3 files changed, 10 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 34aed16..f4f6514 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -10045,7 +10045,9 @@
 				 * emulation.  The DTMF digits can come so fast that emulation
 				 * can drop some of them.
 				 */
+				ast_channel_lock(chan);
 				ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
+				ast_channel_unlock(chan);
 				off_ms = 4000;/* This is a typical OFF time between rings. */
 				for (;;) {
 					struct ast_frame *f;
@@ -10078,7 +10080,9 @@
 						ast_channel_state(chan) == AST_STATE_RINGING)
 						break; /* Got ring */
 				}
+				ast_channel_lock(chan);
 				ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
+				ast_channel_unlock(chan);
 				dtmfbuf[k] = '\0';
 				dahdi_setlinear(p->subs[idx].dfd, p->subs[idx].linear);
 				/* Got cid and ring. */
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 53f9fb2..74b4789 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -2414,7 +2414,9 @@
 				 * emulation.  The DTMF digits can come so fast that emulation
 				 * can drop some of them.
 				 */
+				ast_channel_lock(chan);
 				ast_set_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
+				ast_channel_unlock(chan);
 				timeout_ms = 4000;/* This is a typical OFF time between rings. */
 				for (;;) {
 					struct ast_frame *f;
@@ -2449,7 +2451,9 @@
 						break; /* Got ring */
 					}
 				}
+				ast_channel_lock(chan);
 				ast_clear_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY);
+				ast_channel_unlock(chan);
 				dtmfbuf[k] = '\0';
 
 				analog_set_linear_mode(p, idx, oldlinearity);
diff --git a/main/channel.c b/main/channel.c
index d026121..7d22fee 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -5900,7 +5900,9 @@
 	 */
 	ast_set_callerid(chan, cid_num, cid_name, cid_num);
 
+	ast_channel_lock(chan);
 	ast_set_flag(ast_channel_flags(chan), AST_FLAG_ORIGINATED);
+	ast_channel_unlock(chan);
 	ast_party_connected_line_set_init(&connected, ast_channel_connected(chan));
 	if (cid_num) {
 		connected.id.number.valid = 1;

-- 
To view, visit https://gerrit.asterisk.org/9194
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I34c3b1201b1de539945bcfdcb264fff30332d48c
Gerrit-Change-Number: 9194
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180620/3507b9c9/attachment-0001.html>


More information about the asterisk-code-review mailing list