From owner-freebsd-bugs Thu Oct 3 14:50:07 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA29220 for bugs-outgoing; Thu, 3 Oct 1996 14:50:07 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA29210; Thu, 3 Oct 1996 14:50:03 -0700 (PDT) Resent-Date: Thu, 3 Oct 1996 14:50:03 -0700 (PDT) Resent-Message-Id: <199610032150.OAA29210@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, Received: (from nobody@localhost)by.freefall.freebsd.org.id.OAA27565;Thu; (8.7.5/8.7.3);, 3 Oct 1996 14:42:33.-0700 (PDT) Message-Id: <199610032142.OAA27565@freefall.freebsd.org> Date: Thu, 3 Oct 1996 14:42:33 -0700 (PDT) From: jpt@magic.net To: freebsd-gnats-submit@freebsd.org X-Send-Pr-Version: www-1.0 Subject: kern/1716: LKM does not install character devices Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 1716 >Category: kern >Synopsis: LKM does not install character devices >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Oct 3 14:50:02 PDT 1996 >Last-Modified: >Originator: Joseph Thomas >Organization: Minnesota Supercomputer Center, Inc. >Release: FreeBSD-2.2-960801-SNAP >Environment: FreeBSD nevyn.msci.magic.net 2.2-960801-SNAP FreeBSD 2.2-960801-SNAP #4: Thu Oct 3 16:11:05 1996 jpt@nevyn.msci.magic.net:/usr/src/sys/compile/NEVYN i386 >Description: Support was not included for installing character devices into the cdevsw table via lkm. See sys/kern/kern_lkm.c. static int _lkm_dev(lkmtp, cmd) struct lkm_table *lkmtp; int cmd; { ... switch(cmd) { case LKM_E_LOAD: ... switch(args->lkm_devtype) { case LM_DT_BLOCK: ... break; case LM_DT_CHAR: break; <<==== Missing insatll code default: ... } ... } return(err); } case LKM_E_UNLOAD: is also incorrect. Value of "descrip" is only set for LM_DT_BLOCK case but is used for LM_DT_CHAR case. Descrip should either be set outside of inner case (BLOCK/CHAR) or should also be set for CHAR case. >How-To-Repeat: >Fix: *************** *** 703,708 **** --- 703,717 ---- break; case LM_DT_CHAR: + if ( ( i = args->lkm_offset ) == -1 ) /* auto */ + descrip = (dev_t) -1; + else + descrip = makedev ( args->lkm_offset, 0 ); + if ( err = cdevsw_add ( &descrip, args->lkm_dev.cdev, + &(args->lkm_olddev.cdev) ) ) { + break; + } + args->lkm_offset = major ( descrip ); break; default: *************** *** 714,724 **** case LKM_E_UNLOAD: /* current slot... */ i = args->lkm_offset; switch(args->lkm_devtype) { case LM_DT_BLOCK: /* replace current slot contents with old contents */ - descrip = makedev(i,0); bdevsw_add(&descrip, args->lkm_olddev.bdev,NULL); break; --- 723,733 ---- case LKM_E_UNLOAD: /* current slot... */ i = args->lkm_offset; + descrip = makedev(i,0); switch(args->lkm_devtype) { case LM_DT_BLOCK: /* replace current slot contents with old contents */ bdevsw_add(&descrip, args->lkm_olddev.bdev,NULL); break; >Audit-Trail: >Unformatted: