diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-09-02 21:03:49 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-09-02 21:03:49 +0000 |
commit | cf9ae765063f11d1fc5abc735c67a118351b9344 (patch) | |
tree | 128fd5a11cafe9b887bd9a3998f7298a8f8926e4 /xpp/xbus-core.c | |
parent | d6ab733848345a9ff1b564912ada32787ee773a2 (diff) |
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
Diffstat (limited to 'xpp/xbus-core.c')
-rw-r--r-- | xpp/xbus-core.c | 5 |
1 files changed, 5 insertions, 0 deletions
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; } |