[svn-commits] tzafrir: linux/trunk r10450 - /linux/trunk/drivers/dahdi/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jan 25 15:18:29 CST 2012


Author: tzafrir
Date: Wed Jan 25 15:18:25 2012
New Revision: 10450

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=10450
Log:
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 at xorcom.com>
Acked-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>

Modified:
    linux/trunk/drivers/dahdi/dahdi-base.c
    linux/trunk/drivers/dahdi/dahdi-sysfs.c

Modified: linux/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=10450&r1=10449&r2=10450
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-base.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-base.c Wed Jan 25 15:18:25 2012
@@ -6882,9 +6882,8 @@
 
 	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;
 	}
 

Modified: linux/trunk/drivers/dahdi/dahdi-sysfs.c
URL: http://svnview.digium.com/svn/dahdi/linux/trunk/drivers/dahdi/dahdi-sysfs.c?view=diff&rev=10450&r1=10449&r2=10450
==============================================================================
--- linux/trunk/drivers/dahdi/dahdi-sysfs.c (original)
+++ linux/trunk/drivers/dahdi/dahdi-sysfs.c Wed Jan 25 15:18:25 2012
@@ -250,6 +250,8 @@
 	struct dahdi_span *span;
 
 	span = dev_to_span(dev);
+	if (!span->channels)
+		return -ENODEV;
 	return sprintf(buf, "%d\n", span->chans[0]->channo);
 }
 




More information about the svn-commits mailing list