[svn-commits] russell: trunk r1305 - in /trunk: ./ zaptel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Aug 13 21:07:49 MST 2006


Author: russell
Date: Sun Aug 13 23:07:49 2006
New Revision: 1305

URL: http://svn.digium.com/view/zaptel?rev=1305&view=rev
Log:
Merged revisions 1304 via svnmerge from 
https://origsvn.digium.com/svn/zaptel/branches/1.2

........
r1304 | russell | 2006-08-14 00:07:00 -0400 (Mon, 14 Aug 2006) | 3 lines

fix potential deadlock found by kernel's lock checker 
(issue #7620, reported by smurfix, fixed by Corydon)

........

Modified:
    trunk/   (props changed)
    trunk/zaptel.c

Propchange: trunk/
------------------------------------------------------------------------------
--- branch-1.2-merged (original)
+++ branch-1.2-merged Sun Aug 13 23:07:49 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-916,918-936,938-949,958,962,970,990,1004,1011,1017,1031,1033,1060,1062,1064-1066,1069,1071,1076,1079,1081,1097,1101,1151,1185,1187,1205,1233,1235-1236,1243,1248,1259,1262,1298,1300
+/branches/1.2:1-916,918-936,938-949,958,962,970,990,1004,1011,1017,1031,1033,1060,1062,1064-1066,1069,1071,1076,1079,1081,1097,1101,1151,1185,1187,1205,1233,1235-1236,1243,1248,1259,1262,1298,1300,1304

Modified: trunk/zaptel.c
URL: http://svn.digium.com/view/zaptel/trunk/zaptel.c?rev=1305&r1=1304&r2=1305&view=diff
==============================================================================
--- trunk/zaptel.c (original)
+++ trunk/zaptel.c Sun Aug 13 23:07:49 2006
@@ -1135,8 +1135,14 @@
 	/* Assumes channel is already locked */
 	if ((zone >= ZT_TONE_ZONE_MAX) || (zone < -1))
 		return -EINVAL;
-	
-	read_lock(&zone_lock);
+
+	/* Since this routine is called both from IRQ as well as from userspace,
+	 * it is possible that we could be called during an IRQ while userspace
+	 * has locked this.  However unlikely, this could possibly cause a
+	 * deadlock. */
+	if (! read_trylock(&zone_lock))
+		return -EWOULDBLOCK;
+
 	if (zone == -1) {
 		zone = default_zone;
 	}
@@ -1147,7 +1153,7 @@
 	} else {
 		res = -ENODATA;
 	}
-	
+
 	read_unlock(&zone_lock);
 	return res;
 }



More information about the svn-commits mailing list