[zaptel-commits] tzafrir: trunk r1377 - /trunk/xpp/xbus-core.c

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Sat Sep 2 14:03:50 MST 2006


Author: tzafrir
Date: Sat Sep  2 16:03:49 2006
New Revision: 1377

URL: http://svn.digium.com/view/zaptel?rev=1377&view=rev
Log:
Fix a race condition when quickly reconnecting during a disconnect.

Modified:
    trunk/xpp/xbus-core.c

Modified: trunk/xpp/xbus-core.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xbus-core.c?rev=1377&r1=1376&r2=1377&view=diff
==============================================================================
--- trunk/xpp/xbus-core.c (original)
+++ trunk/xpp/xbus-core.c Sat Sep  2 16:03:49 2006
@@ -313,6 +313,10 @@
 	int			xpd_num;
 	xbus_t			*xbus = data;
 
+	if(!down_read_trylock(&xbus->in_use)) {
+		ERR("%s is being removed...\n", xbus->busname);
+		return -EBUSY;
+	}
 	spin_lock_irqsave(&xbus->lock, flags);
 	DBG("%s\n", xbus->busname);
 
@@ -398,6 +402,7 @@
 		card_detected(card_desc);
 	}
 	complete_all(&xbus->xpds_initialized);
+	up_read(&xbus->in_use);
 	return 0;
 }
 



More information about the zaptel-commits mailing list