summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorKevin Harwell <kharwell@digium.com>2017-06-20 15:41:14 -0500
committerKevin Harwell <kharwell@digium.com>2017-06-21 16:17:02 -0500
commit1f9913f2723cbcbf6d78f4da7ee4dd4decc13c05 (patch)
tree00093fea5dca50b1f15931ee0fe35962de0e8993 /include/asterisk
parent2619c04f1ea72dedf9e48d4452435d3766e5323c (diff)
core_local: local channel data not being properly unref'ed and unlocked
In an earlier version of Asterisk a local channel [un]lock all functions were added in order to keep a crash from occurring when a channel hung up too early during an attended transfer. Unfortunately, when a transfer failure occurs and depending on the timing, the local channels sometime do not get properly unlocked and deref'ed after being locked and ref'ed. This happens because the underlying local channel structure gets NULLed out before unlocking. This patch reworks those [un]lock functions and makes sure the values that get locked and ref'ed later get unlocked and deref'ed. ASTERISK-27074 #close Change-Id: Ice96653e29bd9d6674ed5f95feb6b448ab148b09
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/core_local.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/asterisk/core_local.h b/include/asterisk/core_local.h
index 8557072c6..7d6698336 100644
--- a/include/asterisk/core_local.h
+++ b/include/asterisk/core_local.h
@@ -45,6 +45,8 @@ struct stasis_message_type;
* \brief Lock the "chan" and "owner" channels (and return them) on the base
* private structure as well as the base private structure itself.
*
+ * \deprecated - *DO NOT USE* Please use ast_local_lock_all2 instead.
+ *
* \note This also adds references to each of the above mentioned elements and
* also the underlying private local structure.
* \note None of these locks should be held prior to calling this function.
@@ -60,9 +62,28 @@ void ast_local_lock_all(struct ast_channel *chan, struct ast_channel **outchan,
struct ast_channel **outowner);
/*!
+ * \brief Add a reference to the local channel's private tech, lock the local channel's
+ * private base, and add references and lock both sides of the local channel.
+ *
+ * \note None of these locks should be held prior to calling this function.
+ * \note To undo this process call ast_local_unlock_all2.
+ *
+ * \since 13.17.0, 14.6.0
+ *
+ * \param chan Must be a local channel
+ * \param tech_pvt [out] channel's private tech (ref and lock added)
+ * \param base_chan [out] One side of the local channel (ref and lock added)
+ * \param base_owner [out] Other side of the local channel (ref and lock added)
+ */
+void ast_local_lock_all2(struct ast_channel *chan, void **tech_pvt,
+ struct ast_channel **base_chan, struct ast_channel **base_owner);
+
+/*!
* \brief Unlock the "chan" and "owner" channels on the base private structure
* as well as the base private structure itself.
*
+ * \deprecated - *DO NOT USE* Please use ast_local_unlock_all2 instead.
+ *
* \note This also removes references to each of the above mentioned elements and
* also the underlying private local structure.
* \note This function should be used in conjunction with ast_local_lock_all.
@@ -74,6 +95,22 @@ void ast_local_lock_all(struct ast_channel *chan, struct ast_channel **outchan,
void ast_local_unlock_all(struct ast_channel *chan);
/*!
+ * \brief Remove a reference to the given local channel's private tech, unlock the given
+ * local channel's private base, and remove references and unlock both sides of
+ * given the local channel.
+ *
+ * \note This function should be used in conjunction with ast_local_lock_all2.
+ *
+ * \since 13.17.0, 14.6.0
+ *
+ * \param tech_pvt channel's private tech (ref and lock removed)
+ * \param base_chan One side of the local channel (ref and lock removed)
+ * \param base_owner Other side of the local channel (ref and lock removed)
+ */
+void ast_local_unlock_all2(void *tech_pvt, struct ast_channel *base_chan,
+ struct ast_channel *base_owner);
+
+/*!
* \brief Get the other local channel in the pair.
* \since 12.0.0
*