Hi,

Here's a patch against 2.4.19-pre2 that updates the USB kaweth driver to
the latest version.  It fixes the following problems:
        - a memory allocation bug,
        - a SMP deadlock,
        - synchronous unlink with a spinlock held,
        - a memory leak without firmware,
        - freeing urbs without unlinking
This patch was done by Oliver Neukum.

thanks,

greg k-h



diff -Nru a/drivers/usb/kaweth.c b/drivers/usb/kaweth.c
--- a/drivers/usb/kaweth.c      Mon Mar  4 08:48:58 2002
+++ b/drivers/usb/kaweth.c      Mon Mar  4 08:48:58 2002
@@ -238,8 +238,7 @@
                return -EBUSY;
        }
 
-       dr = kmalloc(sizeof(devrequest), 
-                     in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
+       dr = kmalloc(sizeof(devrequest), GFP_ATOMIC);
 
        if(!dr)
        {
@@ -587,14 +586,10 @@
 {
        struct kaweth_device *kaweth = urb->context;
 
-       spin_lock(&kaweth->device_lock);
-
        if (urb->status)
                kaweth_dbg("%s: TX status %d.", kaweth->net->name, urb->status);
 
        netif_wake_queue(kaweth->net);
-
-       spin_unlock(&kaweth->device_lock);
 }
 
 /****************************************************************
@@ -722,6 +717,7 @@
        kaweth->stats.tx_errors++;
        net->trans_start = jiffies;
 
+       kaweth->tx_urb->transfer_flags |= USB_ASYNC_UNLINK;
        usb_unlink_urb(kaweth->tx_urb);
 }
 
@@ -825,6 +821,7 @@
 
                /* Device will now disappear for a moment...  */
                kaweth_info("Firmware loaded.  I'll be back...");
+               kfree(kaweth);
                return NULL;
        }
 
@@ -926,6 +923,9 @@
                kaweth_warn("unregistering non-existant device");
                return;
        }
+
+       usb_unlink_urb(kaweth->rx_urb);
+       usb_unlink_urb(kaweth->tx_urb);
 
        if(kaweth->net) {
                if(kaweth->net->flags & IFF_UP) {


_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to