dahdi: Do not dereference chan->span for pseudo channels.

Fixes a regression introduced in r9510 which saves a pointer to the ops
member of a channel's span before checking if the channel is a pseudo.
Psuedo channels do not have spans.

(issue #18463)
(issue #18422)
Reported by: alecdavis

Signed-off-by: Shaun Ruffell <sruffell@digium.com>

git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9530 a0bf4364-ded3-4de4-8d8a-66a801d63aff
This commit is contained in:
Shaun Ruffell 2010-12-13 14:57:12 +00:00
parent 60c4681ec8
commit 3203aaf84c

View File

@ -2739,7 +2739,6 @@ static int dahdi_specchan_open(struct file *file)
res = -EBUSY;
else if (!test_and_set_bit(DAHDI_FLAGBIT_OPEN, &chan->flags)) {
unsigned long flags;
const struct dahdi_span_ops *ops;
res = initialize_channel(chan);
if (res) {
/* Reallocbufs must have failed */
@ -2747,10 +2746,11 @@ static int dahdi_specchan_open(struct file *file)
return res;
}
spin_lock_irqsave(&chan->lock, flags);
ops = chan->span->ops;
if (is_pseudo_chan(chan))
chan->flags |= DAHDI_FLAG_AUDIO;
if (chan->span) {
const struct dahdi_span_ops *const ops =
chan->span->ops;
if (!try_module_get(ops->owner)) {
res = -ENXIO;
} else if (ops->open) {