diff options
author | Shaun Ruffell <sruffell@digium.com> | 2008-09-18 21:21:11 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2008-09-18 21:21:11 +0000 |
commit | 36c6135a96faf330bb490ab957ab95dc627477d8 (patch) | |
tree | c10747f6aaeb1294c4d41c62e914ab0c1fc39023 | |
parent | d3b46227b5b75c4eca5c178f8fe47efa3cbff85f (diff) |
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
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@4956 a0bf4364-ded3-4de4-8d8a-66a801d63aff
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 3 | ||||
-rw-r--r-- | drivers/dahdi/wcte12xp/base.c | 2 |
2 files changed, 3 insertions, 2 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index be41260..48361e2 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -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 @@ static int dahdi_reallocbufs(struct dahdi_chan *ss, int j, int numbufs) /* 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; diff --git a/drivers/dahdi/wcte12xp/base.c b/drivers/dahdi/wcte12xp/base.c index 9b61e12..6438787 100644 --- a/drivers/dahdi/wcte12xp/base.c +++ b/drivers/dahdi/wcte12xp/base.c @@ -1070,7 +1070,7 @@ static int t1xxp_echocan_with_params(struct dahdi_chan *chan, struct dahdi_echoc 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; |