Date: Mon, 23 Jun 2014 04:55:46 +0200 From: Hans Petter Selasky <hps@selasky.org> To: "Lundberg, Johannes" <johannes@brilliantservice.co.jp> Cc: FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: ucom_free Fatal trap on shutdown / module unload Message-ID: <53A79732.6060705@selasky.org> In-Reply-To: <CAASDrVnpVgmP4zg0jbqAc197DnX5_bgWRE3pA08foRMF6N9WVQ@mail.gmail.com> References: <CAASDrVkFfhyU8Jb4EB%2B4V32skfFijX9TKLSysjGK=0ye=G9GgA@mail.gmail.com> <53A3E81B.5050805@selasky.org> <CAASDrVnpVgmP4zg0jbqAc197DnX5_bgWRE3pA08foRMF6N9WVQ@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53A79732.6060705>