From owner-freebsd-bugs Fri Mar 23 14: 0:10 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1C5FA37B719 for ; Fri, 23 Mar 2001 14:00:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f2NM03q36535; Fri, 23 Mar 2001 14:00:03 -0800 (PST) (envelope-from gnats) Date: Fri, 23 Mar 2001 14:00:03 -0800 (PST) Message-Id: <200103232200.f2NM03q36535@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Peter Wemm Subject: Re: kern/26034: kldload() panics if error code is returned from _load(). Reply-To: Peter Wemm Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org The following reply was made to PR kern/26034; it has been noted by GNATS. From: Peter Wemm To: jtrainor@fastekintl.com Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: kern/26034: kldload() panics if error code is returned from _load(). Date: Fri, 23 Mar 2001 13:50:52 -0800 jtrainor@fastekintl.com wrote: > > >Number: 26034 > >Category: kern > >Synopsis: kldload() panics if error code is returned from _load(). > >Description: > panic trap 12 (page fault) in kldload while attempting to return an error fro m _load. If I set the return value prior to entering the case statement, proper behavior is observed. If I set the return value inside the case statement, panic occurs. See code below. This is because if you fail on the MOD_LOAD case, the linker calls all the MOD_UNLOADs for the modules in the kld file. In your case, you are calling "destroy_dev(sdev);" on MOD_UNLOAD, which is panicing since sdev is uninitialized. This is actually a bug in your module due to the existing module load/unload semantics. Remember, there can be more than one module inside a .ko kld file. One could argue that a MOD_UNLOAD event should be skipped for modules that have failed to load successfully.. I think this change needs to happen. Cheers, -Peter -- Peter Wemm - peter@FreeBSD.org; peter@yahoo-inc.com; peter@netplex.com.au "All of this is for nothing if we don't go to the stars" - JMS/B5 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message