diff options
author | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-01-25 21:18:25 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2012-01-25 21:18:25 +0000 |
commit | 75acff0164c908083b32cc4401ce4f9d7917e7f2 (patch) | |
tree | 7ebf5833a6cafc630c2e94992a4ffd2fb9ecb545 /drivers/dahdi/dahdi-sysfs.c | |
parent | 078afd65fbae57261f7c4880747e6c5a71cf2a1c (diff) |
A channel-less span should not crash dahdi
* Always check span->channels before accessing span->chans[0]
* Clean one dev_notice() text that accessed span->chans[0]
* Check channels in basechan_show() sysfs attribute
Signed-off-by: Oron Peled <oron.peled@xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10450 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/dahdi-sysfs.c')
-rw-r--r-- | drivers/dahdi/dahdi-sysfs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c index c638104..3b9784d 100644 --- a/drivers/dahdi/dahdi-sysfs.c +++ b/drivers/dahdi/dahdi-sysfs.c @@ -250,6 +250,8 @@ static BUS_ATTR_READER(basechan_show, dev, buf) struct dahdi_span *span; span = dev_to_span(dev); + if (!span->channels) + return -ENODEV; return sprintf(buf, "%d\n", span->chans[0]->channo); } |