From owner-cvs-all Fri Aug 13 22:12:31 1999 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 19A5315054; Fri, 13 Aug 1999 22:12:28 -0700 (PDT) (envelope-from wpaul@FreeBSD.org) Received: (from wpaul@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id WAA70637; Fri, 13 Aug 1999 22:11:02 -0700 (PDT) (envelope-from wpaul@FreeBSD.org) Message-Id: <199908140511.WAA70637@freefall.freebsd.org> From: Bill Paul Date: Fri, 13 Aug 1999 22:11:02 -0700 (PDT) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/sys/kern subr_bus.c Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk wpaul 1999/08/13 22:11:02 PDT Modified files: sys/kern subr_bus.c Log: Grrrr. Fix a really lame bug that I tripped over while testing my miibus stuff: unregister_methods() is horribly broken. The idea, if I'm not mistaken, is that the refcount on a method is decremented, and only when it reaches zero is the method freed. However desc->method is set to NULL unconditionally regardless of the refcount, which means the method pointer is trashed the first time the method is deallocated. The obvious detrimental effect is that memory is leaked. The not so obvious effect is that when you call unregister_method() the second time on the same method, you get a NULL pointer dereference and a panic. Now I can successfully unload network device drivers and the miibus module without crashing the system. *sigh* Revision Changes Path 1.36 +2 -2 src/sys/kern/subr_bus.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message