On Mon, Feb 27, 2012 at 4:23 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Mon, 27 Feb 2012, Adrien Decostre wrote: > >> Dear all, >> >> I am currently doing some tests to communicate with an USB HID device >> by means of the HIDAPI and libusb libraries on a Linux x64 >> distribution. >> One of these tests consists basically of successive enumeration cycles: >> - opening the hid device >> - exchanging some data between the host and the device >> - at some point, closing the communication with the hid device >> - wait a few second and reiterate the above steps >> >> This test runs correctly a few times and then suddenly crashes. >> Apparently, this crash happens in a random way. >> >> The strange point is that after this crash, the file system in RAM is >> "corrupted": some folders like ‘etc’ have disappeared and I have to >> reboot the kernel. > > I have no idea what could be causing that corruption, unless the > filesystems in question reside on a USB drive. For one of the 2 PCs, this is indeed the case. I must further check for the other one. >> The crash has been seen on 2 different machines: >> - on x64 Ubuntu 2.6.35 based kernel (Ubuntu 10.10) >> - on x64 Angström 2.6.39 based kernel (the log given below have been >> obtained on this machine). On this last machine, the crash happens >> only on the 2nd usb bus. When the test usb device is connected to the >> 1st bus usb, I have not seen any problem up to now. >> >> When looking to the dmesg output, the crash seems to be caused by the >> kworker process. The crash log starts with a crash of the ehci driver >> (see below for a complete dmesg log): >> ehci_hcd 0000:00:13.2: force halt; handshake ffffc90000070024 00004000 >> 00000000 -> -110 >> ehci_hcd 0000:00:13.2: HC died; cleaning up >> usb 2-4: usbfs: usb_submit_urb returned -110 >> usb 2-3: USB disconnect, device number 2 >> >> In the past days, I have been looking for a possible bug in my test >> application or in the HIDAPI / libusb libraries (cf. >> http://libusb.6.n5.nabble.com/Application-using-HIDAPI-and-libusb-causes-file-system-corruption-td5508578.html) >> but I am now wondering if this could be related to a known issue in >> the kernel. > > It's a known bug in the EHCI hardware in quite a few different > platforms. Here's an experimental patch to work around it: > > http://marc.info/?l=linux-usb&m=132440828606642&w=2 > > You may have to do some hand editing to get that patch to apply, > because you're using some old kernels. Thanks a lot for this information. I did quick test today and it apparently solves the issue. I will test it more extensively in the coming days. >> Has someone already seen a similar issue with any application? >> Could a bug in an userspace application cause this kernel crash? > > Most unlikely. > > Alan Stern > Best regards Adrien -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html