From brandt@fokus.gmd.de  Thu Mar 28 00:31:33 2002
Return-Path: <brandt@fokus.gmd.de>
Received: from mailhub.fokus.gmd.de (mailhub.fokus.gmd.de [193.174.154.14])
	by hub.freebsd.org (Postfix) with ESMTP id 13FE737B405
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Mar 2002 00:31:32 -0800 (PST)
Received: from fokus.gmd.de (beagle [193.175.132.100])
	by mailhub.fokus.gmd.de (8.11.6/8.11.6) with ESMTP id g2S8VUL09801
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 28 Mar 2002 09:31:30 +0100 (MET)
Received: (from root@localhost)
	by fokus.gmd.de (8.11.6/8.11.0) id g2S8VUK00451;
	Thu, 28 Mar 2002 09:31:30 +0100 (CET)
	(envelope-from hbb)
Message-Id: <200203280831.g2S8VUK00451@fokus.gmd.de>
Date: Thu, 28 Mar 2002 09:31:30 +0100 (CET)
From: Hartmut Brandt <brandt@fokus.gmd.de>
Reply-To: Hartmut Brandt <brandt@fokus.gmd.de>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: the bktr driver tries to destroy device aliases and panics the kernel
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         36413
>Category:       kern
>Synopsis:       the bktr driver tries to destroy device aliases and panics the kernel
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    roger
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 28 00:40:01 PST 2002
>Closed-Date:    Mon Dec 09 01:10:03 PST 2002
>Last-Modified:  Mon Dec 09 01:10:03 PST 2002
>Originator:     Hartmut Brandt
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
FhI Fokus
>Environment:
System: FreeBSD beagle.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #31: Wed Mar 27 14:48:19 CET 2002 hbb@beagle.fokus.gmd.de:/opt/obj/usr/src/sys/BEAGLE i386


	
>Description:

For unit number 0 the bktr driver creates device aliases without the unit
number in the name. When unloaded the driver calls destroy_dev on these aliases,
although make_dev(9) explicitly states, that this should not be done.
Consequently the kernel panics in the devfs code with a 'Don't do that'.

>How-To-Repeat:

kldload bktr
kldunload bktr

>Fix:

Apply the following patch to bktr_os.c

Index: bktr_os.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/bktr/bktr_os.c,v
retrieving revision 1.24
diff -u -r1.24 bktr_os.c
--- bktr_os.c	4 Nov 2001 11:50:08 -0000	1.24
+++ bktr_os.c	28 Mar 2002 08:27:07 -0000
@@ -481,19 +481,11 @@
 	/* The memory is retained by the bktr_mem module so we can unload and */
 	/* then reload the main bktr driver module */
 
-	/* Unregister the /dev/bktrN, tunerN and vbiN devices */
+	/* Unregister the /dev/bktrN, tunerN and vbiN devices,
+	 * the aliases for unit 0 are automatically destroyed */
 	destroy_dev(bktr->vbidev);
 	destroy_dev(bktr->tunerdev);
 	destroy_dev(bktr->bktrdev);
-
-	/* If this is unit 0, then destroy the alias entries too */
-#if (__FreeBSD_version >=500000)
-	if (unit == 0) {
-	    destroy_dev(bktr->vbidev_alias);
-	    destroy_dev(bktr->tunerdev_alias);
-	    destroy_dev(bktr->bktrdev_alias);
-	}
-#endif
 
 	/*
 	 * Deallocate resources.


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->roger 
Responsible-Changed-By: johan 
Responsible-Changed-When: Tue Aug 20 14:17:56 PDT 2002 
Responsible-Changed-Why:  
Over to bktr maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36413 
State-Changed-From-To: open->closed 
State-Changed-By: roger 
State-Changed-When: Mon Dec 9 01:09:39 PST 2002 
State-Changed-Why:  
Patch committed to -current. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=36413 
>Unformatted:
