Subject: kern/14289: bktr(4) may cause a kernel panic.
To: None <gnats-bugs@gnats.netbsd.org>
From: None <fwkg7679@mb.infoweb.ne.jp>
List: netbsd-bugs
Date: 10/18/2001 08:53:11
>Number:         14289
>Category:       kern
>Synopsis:       bktr(4) may cause a kernel panic.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 18 08:54:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     KUROSAWA Takahiro
>Release:        NetBSD 1.5Y
>Organization:
>Environment:
NetBSD fiva 1.5Y NetBSD 1.5Y (FIVA) #8: Wed Oct 17 14:17:57 JST 2001 kurosawa@fiva:/usr/src/sys/arch/i386/compile/FIVA i386
>Description:
bktr(4) causes a kernel panic when the following conditions are met:
- bktr(4) is configured in the kernel
- no driver instance of bktr is attached
- /dev/bktr0 is opened
>How-To-Repeat:
Boot the bktr(4)-configured kernel on the system without bktr cards,
then run:
     cat /dev/bktr0
>Fix:
The following patch will fix the problem:

Index: dev/pci/bktr/bktr_os.c
===================================================================
RCS file: /home/kurosawa/cvsroot/netbsd-src/sys/dev/pci/bktr/bktr_os.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 bktr_os.c
--- dev/pci/bktr/bktr_os.c	2001/10/10 05:17:50	1.1.1.2
+++ dev/pci/bktr/bktr_os.c	2001/10/18 15:45:33
@@ -1620,7 +1620,7 @@
 	unit = UNIT(dev);
 
 	/* unit out of range */
-	if ((unit > bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
+	if ((unit >= bktr_cd.cd_ndevs) || (bktr_cd.cd_devs[unit] == NULL))
 		return(ENXIO);
 
 	bktr = bktr_cd.cd_devs[unit];


>Release-Note:
>Audit-Trail:
>Unformatted: