[dahdi-commits] sruffell: linux/trunk r4917 - /linux/trunk/drivers/dahdi/dahdi-base.c

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Wed Sep 17 10:26:06 CDT 2008


Author: sruffell
Date: Wed Sep 17 10:26:05 2008
New Revision: 4917

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4917
Log:
Turn off reference counting on the echo canceller modules in order to prevent
misconfigurations from preventing the drivers from unloading.  

NOTE: This is only a temporary workaround, since it also means that the
echocanceller can be unloaded by an administrator while in use, which would
most likely result in a kernel oops.

Related to issue #13504.

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=4917&r1=4916&r2=4917
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Wed Sep 17 10:26:05 2008
@@ -190,6 +190,13 @@
 #define class_create class_simple_create
 #define class_destroy class_simple_destroy
 #endif
+
+/*
+ * See issue http://bugs.digium.com/view.php?id=13504 for more information. 
+ * on why reference counting on the echo canceller modules is disabled
+ * currently.
+ */
+#undef USE_ECHOCAN_REFCOUNT 
 
 static int deftaps = 64;
 
@@ -1075,7 +1082,6 @@
 	const char *d;
 	char modname_buf[128] = "dahdi_echocan_";
 	unsigned int tried_once = 0;
-	int res;
 
 	for (c = name_upper, d = name; *d; c++, d++) {
 		*c = toupper(*d);
@@ -1088,13 +1094,18 @@
 
 	list_for_each_entry(cur, &echocan_list, list) {
 		if (!strcmp(name_upper, cur->ec->name)) {
-			if ((res = try_module_get(cur->owner))) {
+#ifdef USE_ECHOCAN_REFCOUNT
+			if (try_module_get(cur->owner)) {
 				read_unlock(&echocan_list_lock);
 				return cur->ec;
 			} else {
 				read_unlock(&echocan_list_lock);
 				return NULL;
 			}
+#else
+			read_unlock(&echocan_list_lock);
+			return cur->ec;
+#endif
 		}
 	}
 
@@ -1120,7 +1131,9 @@
 
 static void release_echocan(const struct dahdi_echocan *ec)
 {
+#ifdef USE_ECHOCAN_REFCOUNT
 	module_put(ec->owner);
+#endif
 }
 
 static void close_channel(struct dahdi_chan *chan)
@@ -4818,12 +4831,14 @@
 			ecp->tap_length = deftaps;
 		}
 
+#ifdef USE_ECHOCAN_REFCOUNT
 		/* try to get another reference to the module providing
 		   this channel's echo canceler */
 		if (!try_module_get(chan->ec_factory->owner)) {
 			module_printk(KERN_ERR, "Cannot get a reference to the '%s' echo canceler\n", chan->ec_factory->name);
 			goto exit_with_free;
 		}
+#endif
 
 		/* got the reference, copy the pointer and use it for making
 		   an echo canceler instance if possible */




More information about the dahdi-commits mailing list