Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Oct 1996 14:42:33 -0700 (PDT)
From:      jpt@magic.net
To:        freebsd-gnats-submit@freebsd.org
Subject:   kern/1716: LKM does not install character devices
Message-ID:  <199610032142.OAA27565@freefall.freebsd.org>
Resent-Message-ID: <199610032150.OAA29210@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610032142.OAA27565>