ucom_free Fatal trap on shutdown / module unload

Lundberg, Johannes johannes at brilliantservice.co.jp
Mon Jun 23 05:34:54 UTC 2014


I added some logging to see what is going on and this is what I got (none
of the proposed solution solved the problem)

uhso_detach gets called 7 times (for oid 0-6). It crashes the 2nd time on
the call usbd_transfer_unsetup(sc->sc_xfer, 3);

--
Johannes Lundberg
BRILLIANTSERVICE CO., LTD.


On Mon, Jun 23, 2014 at 11:55 AM, Hans Petter Selasky <hps at selasky.org>
wrote:

> 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
>

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.


More information about the freebsd-current mailing list