[dahdi-commits] dahdi/linux.git branch "master" updated.

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Sun Mar 23 10:26:24 CDT 2014


branch "master" has been updated
       via  6593097586fb134cf399d6d954202ce92b5f94ec (commit)
      from  e62f0f18353bbe23e9f0a07c106145dde729cc19 (commit)

Summary of changes:
 drivers/dahdi/xpp/xbus-core.c  |   12 ++++++++----
 drivers/dahdi/xpp/xbus-sysfs.c |   30 ++++--------------------------
 2 files changed, 12 insertions(+), 30 deletions(-)


- Log -----------------------------------------------------------------
commit 6593097586fb134cf399d6d954202ce92b5f94ec
Author: Oron Peled <oron.peled at xorcom.com>
Date:   Mon Mar 17 11:55:29 2014 -0400

    xpp: fix PANIC for old dahdi_registration
    
    * dahdi_registration writes multiple times to:
         /sys/bus/astribanks/devices/*/*/span
    * In some race cases this resulted in corruption and eventual kernel
      panic.
    * Until migration to "assigned-spans" is complete:
      - Accept and ignore multiple "dahdi registrations" from user-space.
    
    Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

diff --git a/drivers/dahdi/xpp/xbus-core.c b/drivers/dahdi/xpp/xbus-core.c
index 8887c1e..a7bb798 100644
--- a/drivers/dahdi/xpp/xbus-core.c
+++ b/drivers/dahdi/xpp/xbus-core.c
@@ -953,10 +953,14 @@ int xbus_register_dahdi_device(xbus_t *xbus)
 		goto err;
 	}
 	if (xbus_is_registered(xbus)) {
-		XBUS_ERR(xbus, "Already registered to DAHDI\n");
-		WARN_ON(1);
-		ret = -EINVAL;
-		goto err;
+		/*
+		 * Ignore duplicate registrations (from dahdi_registration)
+		 * Until we completely migrate to dahdi_autoreg=1 and
+		 * hotplug-based span-assignments
+		 */
+		XBUS_DBG(DEVICES, xbus, "Already registered to DAHDI\n");
+		ret = 0;
+		goto out;
 	}
 	xbus->ddev = dahdi_create_device();
 	if (!xbus->ddev) {
diff --git a/drivers/dahdi/xpp/xbus-sysfs.c b/drivers/dahdi/xpp/xbus-sysfs.c
index 5861054..24dcda2 100644
--- a/drivers/dahdi/xpp/xbus-sysfs.c
+++ b/drivers/dahdi/xpp/xbus-sysfs.c
@@ -23,7 +23,6 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
-#include <linux/mutex.h>
 #include <linux/proc_fs.h>
 #ifdef	PROTOCOL_DEBUG
 #include <linux/ctype.h>
@@ -596,8 +595,6 @@ static DEVICE_ATTR_READER(span_show, dev, buf)
 	return len;
 }
 
-static DEFINE_MUTEX(span_store_mutex);
-
 /*
  * For backward compatibility with old dahdi-tools
  * Remove after dahdi_registration is upgraded
@@ -619,29 +616,10 @@ static DEVICE_ATTR_WRITER(span_store, dev, buf, count)
 		return -ENODEV;
 	XPD_DBG(DEVICES, xpd, "%s -- deprecated (should use assigned-spans)\n",
 		(dahdi_reg) ? "register" : "unregister");
-	ret = mutex_lock_interruptible(&span_store_mutex);
-	if (ret < 0) {
-		XBUS_ERR(xpd->xbus, "span_store_mutex already taken\n");
-		return ret;
-	}
-	if (xbus_is_registered(xpd->xbus)) {
-		if (dahdi_reg) {
-			XPD_DBG(DEVICES, xpd,
-				"already registered %s. Ignored.\n",
-				xpd->xbus->busname);
-		} else {
-			xbus_unregister_dahdi_device(xpd->xbus);
-		}
-	} else {
-		if (!dahdi_reg) {
-			XPD_DBG(DEVICES, xpd,
-				"already unregistered %s. Ignored.\n",
-				xpd->xbus->busname);
-		} else {
-			xbus_register_dahdi_device(xpd->xbus);
-		}
-	}
-	mutex_unlock(&span_store_mutex);
+	if (dahdi_reg)
+		xbus_register_dahdi_device(xpd->xbus);
+	  else
+		xbus_unregister_dahdi_device(xpd->xbus);
 	return count;
 }
 

-----------------------------------------------------------------------


-- 
dahdi/linux.git



More information about the dahdi-commits mailing list