Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netisdn Avoid NULL pointer dereferences on incomplete se...



details:   https://anonhg.NetBSD.org/src/rev/5d1eaf92c995
branches:  trunk
changeset: 559662:5d1eaf92c995
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Mar 21 16:29:40 2004 +0000

description:
Avoid NULL pointer dereferences on incomplete setup by userland.
Fixes PR kern/24807.

diffstat:

 sys/netisdn/i4b_l4.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 81ed691aa1fc -r 5d1eaf92c995 sys/netisdn/i4b_l4.c
--- a/sys/netisdn/i4b_l4.c      Sun Mar 21 16:25:56 2004 +0000
+++ b/sys/netisdn/i4b_l4.c      Sun Mar 21 16:29:40 2004 +0000
@@ -27,7 +27,7 @@
  *     i4b_l4.c - kernel interface to userland
  *     -----------------------------------------
  *
- *     $Id: i4b_l4.c,v 1.25 2003/10/03 16:38:44 pooka Exp $ 
+ *     $Id: i4b_l4.c,v 1.26 2004/03/21 16:29:40 martin Exp $ 
  *
  * $FreeBSD$
  *
@@ -36,7 +36,7 @@
  *---------------------------------------------------------------------------*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.25 2003/10/03 16:38:44 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i4b_l4.c,v 1.26 2004/03/21 16:29:40 martin Exp $");
 
 #include "isdn.h"
 #include "irip.h"
@@ -600,7 +600,8 @@
 
        update_controller_leds(cd->l3drv);
 
-       (*cd->l4_driver->line_connected)(cd->l4_driver_softc, cd);
+       if (cd->l4_driver != NULL && cd->l4_driver_softc != NULL)
+               (*cd->l4_driver->line_connected)(cd->l4_driver_softc, cd);
 
        i4b_l4_setup_timeout(cd);
        
@@ -930,7 +931,8 @@
 static time_t
 i4b_get_idletime(call_desc_t *cd)
 {
-       if (cd->l4_driver->get_idletime)
+       if (cd->l4_driver != NULL && cd->l4_driver_softc != NULL
+           && cd->l4_driver->get_idletime)
                return cd->l4_driver->get_idletime(cd->l4_driver_softc);
        return cd->last_active_time;
 }



Home | Main Index | Thread Index | Old Index