diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 305ea67..618754d 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -2414,6 +2414,9 @@ static ssize_t dahdi_chan_read(struct file *file, char __user *usrbuf, if (unlikely(count < 1)) return -EINVAL; + if (unlikely(!test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags))) + return -ENODEV; + for (;;) { spin_lock_irqsave(&chan->lock, flags); if (chan->eventinidx != chan->eventoutidx) { @@ -2531,6 +2534,9 @@ static ssize_t dahdi_chan_write(struct file *file, const char __user *usrbuf, if (unlikely(count < 1)) return -EINVAL; + if (unlikely(!test_bit(DAHDI_FLAGBIT_REGISTERED, &chan->flags))) + return -ENODEV; + for (;;) { spin_lock_irqsave(&chan->lock, flags); if ((chan->curtone || chan->pdialcount) && !is_pseudo_chan(chan)) {