From owner-cvs-sys Fri Jun 16 22:02:35 1995 Return-Path: cvs-sys-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id WAA07415 for cvs-sys-outgoing; Fri, 16 Jun 1995 22:02:35 -0700 Received: (from wpaul@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id WAA07395 ; Fri, 16 Jun 1995 22:02:32 -0700 Date: Fri, 16 Jun 1995 22:02:32 -0700 From: Bill Paul Message-Id: <199506170502.WAA07395@freefall.cdrom.com> To: CVS-commiters, cvs-sys Subject: cvs commit: src/sys/sys lkm.h Sender: cvs-sys-owner@freebsd.org Precedence: bulk wpaul 95/06/16 22:02:31 Modified: sys/sys lkm.h Log: Close out PR #507 (loading LM_MISC pseudo-lkms twice crashes system). For the LKM_E_LOAD case of the DISPATCH() macro, use lkmexists() to make sure we don't have another instance the module we're trying to load already loaded _before_ calling the module's load() function. If lkmexists() returns true, return EEXIST without trying to load the module. For most types of modules, the individual dispatch functions in the kernel check for duplicated modules, but for LM_MISC we can't trust the module to do the checks itself. Currently, the kernel does do an lkmexists() check on LM_MISC modules, but not until after the module's load() function has been called, which is too late for it to do any good. If the load() function does irreversible things to the kernel, the belated lkmexists() check forces an unload() and a crash.