Bug#411293: asterisk-chan-capi: Need a mutex for calls to
capi_{cmsg, message}2str
Ben Hutchings
ben at decadent.org.uk
Sat Feb 17 22:40:40 UTC 2007
tags 411293 +patch
thanks
Patch for asterisk-chan-capi:
diff -u asterisk-chan-capi-0.7.1/debian/patches/00list asterisk-chan-capi-0.7.1/debian/patches/00list
--- asterisk-chan-capi-0.7.1/debian/patches/00list
+++ asterisk-chan-capi-0.7.1/debian/patches/00list
@@ -1,0 +2 @@
+02_capi-msg2str-mutex
only in patch2:
unchanged:
--- asterisk-chan-capi-0.7.1.orig/debian/patches/02_capi-msg2str-mutex.dpatch
+++ asterisk-chan-capi-0.7.1/debian/patches/02_capi-msg2str-mutex.dpatch
@@ -0,0 +1,58 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_capi-msg2str-mutex.dpatch by Ben Hutchings <ben at decadent.org.uk>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Protect calls to capi20_{cmsg,message}2str and use of their
+## DP: buffer with a mutex.
+
+ at DPATCH@
+--- asterisk-chan-capi-0.7.0/chan_capi.c~ 2006-10-08 13:38:27.000000000 +0000
++++ asterisk-chan-capi-0.7.0/chan_capi.c 2007-02-17 22:26:32.000000000 +0000
+@@ -167,6 +167,8 @@
+ * 4. cc_mutex_lock(&messagenumber_lock);
+ * 5. cc_mutex_lock(&usecnt_lock);
+ * 6. cc_mutex_lock(&capi_put_lock);
++ * 7. cc_mutex_lock(&capi_msg2str_lock);
++ * 8. cc_mutex_lock(&verbose_lock);
+ *
+ *
+ * ** the PBX will call the callback functions with
+@@ -180,6 +182,7 @@
+ AST_MUTEX_DEFINE_STATIC(usecnt_lock);
+ AST_MUTEX_DEFINE_STATIC(iflock);
+ AST_MUTEX_DEFINE_STATIC(capi_put_lock);
++AST_MUTEX_DEFINE_STATIC(capi_msg2str_lock);
+ AST_MUTEX_DEFINE_STATIC(verbose_lock);
+
+ static int capi_capability = AST_FORMAT_ALAW;
+@@ -402,6 +405,7 @@
+ return -1;
+ }
+
++ cc_mutex_lock(&capi_msg2str_lock);
+ if (error) {
+ cc_log(LOG_ERROR, "CAPI error sending %s (NCCI=%#x) (error=%#x %s)\n",
+ capi_cmsg2str(CMSG), (unsigned int)HEADER_CID(CMSG),
+@@ -415,6 +419,7 @@
+ cc_verbose(4, 1, "%s\n", capi_cmsg2str(CMSG));
+ }
+ }
++ cc_mutex_unlock(&capi_msg2str_lock);
+
+ return error;
+ }
+@@ -3972,12 +3977,14 @@
+ unsigned short wInfo = 0xffff;
+ struct capi_pvt *i = find_interface_by_plci(PLCI);
+
++ cc_mutex_lock(&capi_msg2str_lock);
+ if ((wCmd == CAPI_P_IND(DATA_B3)) ||
+ (wCmd == CAPI_P_CONF(DATA_B3))) {
+ cc_verbose(7, 1, "%s\n", capi_cmsg2str(CMSG));
+ } else {
+ cc_verbose(4, 1, "%s\n", capi_cmsg2str(CMSG));
+ }
++ cc_mutex_unlock(&capi_msg2str_lock);
+
+ if (i != NULL)
+ cc_mutex_lock(&i->lock);
-- END --
Unfortunately I have no suitable hardware with which to test this
package; therefore this is untested except that it builds cleanly.
Ben.
--
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.alioth.debian.org/pipermail/pkg-voip-maintainers/attachments/20070217/99e60fb7/attachment.pgp
More information about the Pkg-voip-maintainers
mailing list