summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-23 22:33:44 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2004-04-23 22:33:44 +0000
commitfac8009465dc826829fb2590a1002288154d6c8a (patch)
tree9fe0fcb6061b02a0ac63e02f87906084ae073a15 /zaptel.c
parent709e2be4a4ed3ea6ef77ec79f9e8101ba56426fa (diff)
Don't do put_user/get_user with spin lock held
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@371 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-xzaptel.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/zaptel.c b/zaptel.c
index ebea1ee..05c8b26 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -3394,24 +3394,25 @@ static int zt_chanandpseudo_ioctl(struct inode *inode, struct file *file, unsign
chan->iomask = 0;
break;
case ZT_GETEVENT: /* Get event on queue */
- spin_lock_irqsave(&chan->lock, flags);
/* set up for no event */
- put_user(ZT_EVENT_NONE,(int *)data);
+ j = ZT_EVENT_NONE;
+ spin_lock_irqsave(&chan->lock, flags);
/* if some event in queue */
if (chan->eventinidx != chan->eventoutidx)
{
+ j = chan->eventbuf[chan->eventoutidx++];
/* get the data, bump index */
- put_user(chan->eventbuf[chan->eventoutidx++],(int *)data);
/* if index overflow, set to beginning */
if (chan->eventoutidx >= ZT_MAX_EVENTSIZE)
chan->eventoutidx = 0;
}
spin_unlock_irqrestore(&chan->lock, flags);
+ put_user(j,(int *)data);
break;
case ZT_CONFMUTE: /* set confmute flag */
+ get_user(j,(int *)data); /* get conf # */
if (!(chan->flags & ZT_FLAG_AUDIO)) return (-EINVAL);
spin_lock_irqsave(&bigzaplock, flags);
- get_user(j,(int *)data); /* get conf # */
chan->confmute = j;
spin_unlock_irqrestore(&bigzaplock, flags);
break;