From cf9ae765063f11d1fc5abc735c67a118351b9344 Mon Sep 17 00:00:00 2001 From: tzafrir Date: Sat, 2 Sep 2006 21:03:49 +0000 Subject: Fix a race condition when quickly reconnecting during a disconnect. git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1377 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- xpp/xbus-core.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'xpp/xbus-core.c') diff --git a/xpp/xbus-core.c b/xpp/xbus-core.c index 3b9d507..5e96147 100644 --- a/xpp/xbus-core.c +++ b/xpp/xbus-core.c @@ -313,6 +313,10 @@ static int xbus_poll(void *data) 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 @@ static int xbus_poll(void *data) card_detected(card_desc); } complete_all(&xbus->xpds_initialized); + up_read(&xbus->in_use); return 0; } -- cgit v1.2.3