summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
authormattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-16 23:12:00 +0000
committermattf <mattf@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-11-16 23:12:00 +0000
commitfa24582c8559240dbae1b241e98257bc015c4165 (patch)
tree12fcfe9411a069e702b36ad3433a0cbe7af6895f /zaptel.c
parent2ef40f44ed6b92816e26cc81d0b872a1aaefb5b8 (diff)
Fix for 7769
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1605 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rw-r--r--zaptel.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/zaptel.c b/zaptel.c
index 4c06ad2..538cb9c 100644
--- a/zaptel.c
+++ b/zaptel.c
@@ -2228,8 +2228,10 @@ static int zt_specchan_open(struct inode *inode, struct file *file, int unit, in
else if ((chans[unit]->sig & __ZT_SIG_DACS) == __ZT_SIG_DACS)
res = -EBUSY;
else {
+ unsigned long flags;
/* Assume everything is going to be okay */
res = initialize_channel(chans[unit]);
+ spin_lock_irqsave(&chans[unit]->lock, flags);
if (chans[unit]->flags & ZT_FLAG_PSEUDO)
chans[unit]->flags |= ZT_FLAG_AUDIO;
if (chans[unit]->span && chans[unit]->span->open)
@@ -2241,7 +2243,9 @@ static int zt_specchan_open(struct inode *inode, struct file *file, int unit, in
MOD_INC_USE_COUNT;
#endif
chans[unit]->flags |= ZT_FLAG_OPEN;
+ spin_unlock_irqrestore(&chans[unit]->lock, flags);
} else {
+ spin_unlock_irqrestore(&chans[unit]->lock, flags);
close_channel(chans[unit]);
}
}
@@ -2254,7 +2258,10 @@ static int zt_specchan_release(struct inode *node, struct file *file, int unit)
{
int res=0;
if (chans[unit]) {
+ unsigned long flags;
+ spin_lock_irqsave(&chans[unit]->lock, flags);
chans[unit]->flags &= ~ZT_FLAG_OPEN;
+ spin_unlock_irqrestore(&chans[unit]->lock, flags);
chans[unit]->file = NULL;
close_channel(chans[unit]);
if (chans[unit]->span && chans[unit]->span->close)