[dahdi-commits] sruffell: linux/trunk r4956 - in /linux/trunk/drivers/dahdi: ./ wcte12xp/

SVN commits to the DAHDI project dahdi-commits at lists.digium.com
Thu Sep 18 16:21:11 CDT 2008


Author: sruffell
Date: Thu Sep 18 16:21:11 2008
New Revision: 4956

URL: http://svn.digium.com/view/dahdi?view=rev&rev=4956
Log:
close_channel is called with a spin_lock held, which means that GFP_KERNEL can
not be used for the memory allocations down that call path.

Have allocations in this call path check if they are in atomic context and use
the appropriate flags.

Issue: DAHDI-195

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/drivers/dahdi/wcte12xp/base.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=4956&r1=4955&r2=4956
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Thu Sep 18 16:21:11 2008
@@ -48,6 +48,7 @@
 #include <linux/kmod.h>
 #include <linux/moduleparam.h>
 #include <linux/list.h>
+#include <linux/interrupt.h>
 
 #ifdef CONFIG_DAHDI_NET
 #include <linux/netdevice.h>
@@ -867,7 +868,7 @@
 
 	/* We need to allocate our buffers now */
 	if (j) {
-		if(!(newbuf = kcalloc(j * 2, numbufs, GFP_KERNEL)))
+		if(!(newbuf = kcalloc(j * 2, numbufs, (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL)))
 			return -ENOMEM;
 	} else
 		newbuf = NULL;

Modified: linux/trunk/drivers/dahdi/wcte12xp/base.c
URL: http://svn.digium.com/view/dahdi/linux/trunk/drivers/dahdi/wcte12xp/base.c?view=diff&rev=4956&r1=4955&r2=4956
==============================================================================
--- linux/trunk/drivers/dahdi/wcte12xp/base.c (original)
+++ linux/trunk/drivers/dahdi/wcte12xp/base.c Thu Sep 18 16:21:11 2008
@@ -1070,7 +1070,7 @@
 	   to control whether the ec is on or off, so translate it */
 	params.tap_length = ecp->tap_length ? 1 : 0;
 
-	if (!(work = kmalloc(sizeof(*work), GFP_KERNEL)))
+	if (!(work = kmalloc(sizeof(*work), (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL)))
 		return -ENOMEM;
 
 	work->params = params;




More information about the dahdi-commits mailing list