summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xzaptel.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/zaptel.c b/zaptel.c
index f1545b6..fe4cb6f 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -2089,7 +2089,11 @@ static int zt_specchan_release(struct inode *node, struct file *file, int unit)
static struct zt_chan *zt_alloc_pseudo(void)
{
- struct zt_chan *pseudo = kmalloc(sizeof(struct zt_chan), GFP_KERNEL);
+ struct zt_chan *pseudo;
+ /* Don't allow /dev/zap/pseudo to open if there are no spans */
+ if (maxspans < 1)
+ return NULL;
+ pseudo = kmalloc(sizeof(struct zt_chan), GFP_KERNEL);
if (!pseudo)
return NULL;
memset(pseudo, 0, sizeof(struct zt_chan));