Index: zaptel.c =================================================================== --- zaptel.c (revision 1317) +++ zaptel.c (working copy) @@ -1135,8 +1135,18 @@ /* Assumes channel is already locked */ if ((zone >= ZT_TONE_ZONE_MAX) || (zone < -1)) return -EINVAL; - + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,11) + /* 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; +#else read_lock(&zone_lock); +#endif + if (zone == -1) { zone = default_zone; } @@ -1147,7 +1157,7 @@ } else { res = -ENODATA; } - + read_unlock(&zone_lock); return res; }