From owner-freebsd-current@FreeBSD.ORG Mon Jun 23 02:55:32 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F58BD6 for ; Mon, 23 Jun 2014 02:55:32 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE3C52285 for ; Mon, 23 Jun 2014 02:55:30 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 7EEBB1FE045; Mon, 23 Jun 2014 04:55:21 +0200 (CEST) Message-ID: <53A79732.6060705@selasky.org> Date: Mon, 23 Jun 2014 04:55:46 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: "Lundberg, Johannes" Subject: Re: ucom_free Fatal trap on shutdown / module unload References: <53A3E81B.5050805@selasky.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2014 02:55:32 -0000 On 06/23/14 03:30, Lundberg, Johannes wrote: > Hi > > I tried replacing > DRIVER_MODULE(uhso, uhub, uhso_driver, uhso_devclass, uhso_driver_loaded, > 0); > with > DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass, > uhso_driver_loaded, 0, SI_ORDER_ANY); > but makes no difference.. > > Don't know if its relevant but with ucom debug on I get a message just > before crash in method ucom_close that it tries to close a connection that > has already been closed. > Hi Johannes, Try the opposite: DRIVER_MODULE_ORDERED(uhso, uhub, uhso_driver, uhso_devclass, uhso_driver_loaded, 0, SI_ORDER_MIDDLE + 1); Because I suspect that the "uhso_ifnet_unit" unrhdr is freed before the "fake" detach is executed: > static int > uhso_driver_loaded(struct module *mod, int what, void *arg) > { > switch (what) { > case MOD_LOAD: > /* register our autoinstall handler */ > uhso_etag = EVENTHANDLER_REGISTER(usb_dev_configured, > uhso_test_autoinst, NULL, EVENTHANDLER_PRI_ANY); > /* create our unit allocator for inet devs */ > uhso_ifnet_unit = new_unrhdr(0, INT_MAX, NULL); > break; > case MOD_UNLOAD: > EVENTHANDLER_DEREGISTER(usb_dev_configured, uhso_etag); > delete_unrhdr(uhso_ifnet_unit); > break; > default: > return (EOPNOTSUPP); > } > return (0); > } Alternativly set "uhso_ifnet_unit" to NULL and check this in probe and attach! --HPS --HPS