diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-08-24 17:55:26 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2009-08-24 17:55:26 +0000 |
commit | 454eeace0a4092d003985857bbcb0e0607a0abcb (patch) | |
tree | 8166826319af570c6bd8c1b30d4abfafd5af34f0 /drivers/dahdi/dahdi-base.c | |
parent | f9cec7abe9147690989c10680ddc9b928a9f3572 (diff) |
Don't dereference the span after a channel was closed.
Releasing the channel may trigger releasing a span in certain cases
(e.g. the last channel on a xpp (Astribank). This gives a niec panic on
closing of Asterisk under the right flow.
As the span was only dereferenced to access the owner field, we can save
it locally.
Issue has been present since r6794 .
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@7066 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/dahdi-base.c')
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index d2d6c97..359458a 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -2719,9 +2719,11 @@ static int dahdi_specchan_release(struct inode *node, struct file *file, int uni spin_unlock_irqrestore(&chan->lock, flags); close_channel(chan); if (chan->span) { + struct module *owner = chan->span->owner; + if (chan->span->close) res = chan->span->close(chan); - module_put(chan->span->owner); + module_put(owner); } /* The channel might be destroyed by low-level driver span->close() */ if (chans[unit]) |