[Asterisk-cvs] zaptel zaptel.c,1.69,1.70

markster at lists.digium.com markster at lists.digium.com
Fri Apr 23 18:28:30 CDT 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv32724

Modified Files:
	zaptel.c 
Log Message:
Don't do put_user/get_user with spin lock held


Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- zaptel.c	19 Apr 2004 15:34:41 -0000	1.69
+++ zaptel.c	23 Apr 2004 22:33:44 -0000	1.70
@@ -3394,24 +3394,25 @@
 		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;




More information about the svn-commits mailing list