From fac8009465dc826829fb2590a1002288154d6c8a Mon Sep 17 00:00:00 2001 From: markster Date: Fri, 23 Apr 2004 22:33:44 +0000 Subject: 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 --- zaptel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'zaptel.c') 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; -- cgit v1.2.3