Index: zaptel.c =================================================================== --- zaptel.c (revision 1253) +++ zaptel.c (working copy) @@ -1091,8 +1091,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; } @@ -1103,7 +1109,7 @@ } else { res = -ENODATA; } - + read_unlock(&zone_lock); return res; }