From 3203aaf84cdc9691a826386e3978aaaca9f18c91 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Mon, 13 Dec 2010 14:57:12 +0000 Subject: [PATCH] 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 git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9530 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 698e37d..a29a63f 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -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) {