Thanks for your great help! I'll not use URB_ASYNC_UNLINK model and adde usb_get_dev in my prob func. and adde usb_put_dev in my disconnect func. And send you the test result ASAP.
Regards, Levis -----Original Message----- From: Pete Zaitcev [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 1:05 PM To: Xu Levis-Q16136 Cc: [EMAIL PROTECTED] Subject: Re: [linux-usb-devel] An usb-ohic issue, could anybodies help me? Thanks a lot! On Mon, 30 Aug 2004 12:01:20 +0800 Xu Levis-Q16136 <[EMAIL PROTECTED]> wrote: > The BUG is located in the function sohci_free_dev() of usb-ohci.c file. > And from the comment "likely some interface's driver has a refcount bug" > it seems a device refcount bug. >[...] > Could anybodies help me to workaround this bug based kernel(2.4.20)? > I have checked Linux-2.6.8 version kerenel, usb host side driver stack is > updated and from the codes this bug should be fixed, right? > But i must use 2.4.20 version kernel. The bug is related to my fix to ohci which made it SMP safe, but I cannot remember now if I broke it, or it was always like that. I attempted to refix this in various ways before, but there's no good, non-invasive fix. The sad truth is that the bug can be triggered by a legitimate use of the USB stack. Essentially, it happens if you try to do an unlink with URB_ASYNC_UNLINK _and_ this unlink drops the last count, so the device is freed. Although legal, this should not normally happen, and this is what the comment about "refcount bug" refers. The correct technique is to do usb_get_dev in your probe method and then in your disconnect method unlink all running URBs and _then_ call usb_put_dev to undo one extra get_dev. This is very important! For many drivers it happens automatically, when they store a pointer to an usb_interface or usb_device but be mindful. Unfortunately, there's more. A use of urb->timeout has the effect of adding URB_ASYNC_UNLINK in the usb-ohci implementation, and thus unsuspecting drivers can get into the same situation as described above even if they do not use URB_ASYNC_UNLINK. To trip this bug is exceedingly rare. In fact I do not know of any drivers in the kernel which trip it (maybe Bluetooth dongles might). For example, the HID looks missing extra dev_get's, but it cancels its URBs in disconnect all the same, and it does not use async unlinks. -- Pete ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
