USB ISP1161 device driver patch

From: Gabriele Brugnoni (news_at_dveprojects.com)
Date: 10/31/05


Date: Mon, 31 Oct 2005 18:10:52 +0100


Hello,

I send this simple patch for the file hcd_1161.c version 1.11, the driver
for the Philips ISP1161 USB device.

This patch fix a problem that may happen when removing the device.
The original code call the free_irq before the hc_release_1161.
If an interrupt occurs after having freed the memory, the interrupt handler
will receive an invalid ohci structure, causing a kernel crash.
Considering that interrupts are generated every millisecond, the problem may
happen frequently (as in may experience).

Bye.
Gabriele B.

--- hcd_1161.c.orig 2004-02-04 19:10:36.000000000 +0100
+++ hcd_1161.c 2005-10-31 17:29:13.000000000 +0100
@@ -4068,8 +4068,14 @@
        ohci_t *ohci = ohci_pci_dev.driver_data;
        int irq = ohci->irq;
 
- hc_release_1161(ohci); /* release the 1161 hc */
+ /* ATTENTION!!!
+ The call to free_irq MUST BE done before calling the hc_release_1161.
+ Previous versions of this code call it after the release function,
+ causing frequently and dangerous exceptions, that occurs if and interrupt
+ is handled after having released the memory (with ohci pointer invalid).
+ */
        free_irq(irq,ohci); /* Free interrupt line */
+ hc_release_1161(ohci); /* release the 1161 hc */
        release_region(HC_IO_BASE, HC_IO_SIZE); /* release IO space */
        ohci_1161_mem_cleanup (); /* Clean up global memory */
 



Relevant Pages

  • Re: Lenovo 3000 N100 i8042 problems
    ... internally we the kernel still deals with 2 interrupt ... Does it take long to trigger the bug? ... new low speed USB device using uhci_hcd and address 2 ... i8042 KBD port at 0x60,0x64 irq 1 ...
    (Linux-Kernel)
  • Re: Problems with NIC
    ... According to polling(4), the dc driver supports polling instead of using ... an interrupt line. ... Or you could disable ohci0 in the bios, or plug the offending USB device ... See the acpi manual page and google for 'irq routing freebsd'. ...
    (freebsd-stable)
  • [PATCH] usb: at91_udc: correct hanging while disconnecting usb cable
    ... This bug was tracked on at91sam9260ek boards. ... A usb resume interrupt was firing after the vbus interrupt: the IP was then already stoped and not able to deal with it. ... A simple interrupt disabling is ok as the "end of bus reset" irq is non maskable and ok to resume the USB device IP. ...
    (Linux-Kernel)
  • Re: USB On-The-Go
    ... The detection of a new USB device on your host is made by the polling thread ... The thread linked with the interrupt, in file chw.c, is here to check the ... But cant find the first PDD routine ...
    (microsoft.public.windowsce.embedded)
  • Re: [BUG] 2.6.12-rc3: unkillable java process in TASK_RUNNING on AMD64
    ... > Does this patch fix the problem? ... > Readd missing clis in the interrupt return path. ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)