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
This commit is contained in:
committed by
Tzafrir Cohen
parent
b8b7b86332
commit
ed6def895b
@@ -6882,9 +6882,8 @@ static int _dahdi_assign_span(struct dahdi_span *span, unsigned int spanno,
|
||||
|
||||
if (test_bit(DAHDI_FLAGBIT_REGISTERED, &span->flags)) {
|
||||
dev_notice(span_device(span),
|
||||
"local span %d is already assigned span %d "
|
||||
"with base channel %d\n", local_spanno(span), span->spanno,
|
||||
span->chans[0]->channo);
|
||||
"local span %d is already assigned span %d\n",
|
||||
local_spanno(span), span->spanno);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user