diff options
-rwxr-xr-x | zaptel.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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)); |