<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.689   -&gt; 1.690  
#	drivers/usb/kaweth.c	1.15    -&gt; 1.16   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/26	oliver@neukum.name	1.690
# [PATCH] USB: fixes for kaweth
# 
# this fixes a few SMP locking issues for kaweth.
# --------------------------------------------
#
diff -Nru a/drivers/usb/kaweth.c b/drivers/usb/kaweth.c
--- a/drivers/usb/kaweth.c	Mon Sep 30 10:47:01 2002
+++ b/drivers/usb/kaweth.c	Mon Sep 30 10:47:01 2002
@@ -495,6 +495,7 @@
 static void kaweth_resubmit_rx_urb(struct kaweth_device *kaweth)
 {
 	int result;
+	long flags;
 
 	FILL_BULK_URB(kaweth-&gt;rx_urb,
 		      kaweth-&gt;dev,
@@ -504,13 +505,17 @@
 		      kaweth_usb_receive,
 		      kaweth);
 
-	if((result = usb_submit_urb(kaweth-&gt;rx_urb))) {
-		if (result == -ENOMEM)
-			kaweth-&gt;suspend_lowmem = 1;
-		kaweth_err("resubmitting rx_urb %d failed", result);
-	} else {
-		kaweth-&gt;suspend_lowmem = 0;
+	spin_lock_irqsave(&amp;kaweth-&gt;device_lock, flags);
+	if (!kaweth-&gt;removed) { /* no resubmit if disconnecting */
+		if((result = usb_submit_urb(kaweth-&gt;rx_urb))) {
+			if (result == -ENOMEM)
+				kaweth-&gt;suspend_lowmem = 1;
+			kaweth_err("resubmitting rx_urb %d failed", result);
+		} else {
+			kaweth-&gt;suspend_lowmem = 0;
+		}
 	}
+	spin_unlock_irqrestore(&amp;kaweth-&gt;device_lock, flags);
 }
 
 static void kaweth_async_set_rx_mode(struct kaweth_device *kaweth);
@@ -625,8 +630,10 @@
 	struct kaweth_device *kaweth = net-&gt;priv;
 
 	netif_stop_queue(net);
-
+	
+	spin_lock_irq(&amp;kaweth-&gt;device_lock);
 	kaweth-&gt;status |= KAWETH_STATUS_CLOSING;
+	spin_unlock_irq(&amp;kaweth-&gt;device_lock);
 
 	usb_unlink_urb(kaweth-&gt;irq_urb);
 	usb_unlink_urb(kaweth-&gt;rx_urb);
@@ -1065,12 +1072,12 @@
 	usb_unlink_urb(kaweth-&gt;rx_urb);
 
 	/* we need to wait for the urb to be cancelled, if it is active */
-	spin_lock(&amp;kaweth-&gt;device_lock);
+	spin_lock_irq(&amp;kaweth-&gt;device_lock);
 	if (usb_unlink_urb(kaweth-&gt;tx_urb) == -EINPROGRESS) {
-		spin_unlock(&amp;kaweth-&gt;device_lock);
+		spin_unlock_irq(&amp;kaweth-&gt;device_lock);
 		wait_event(kaweth-&gt;term_wait, kaweth-&gt;end);
 	} else {
-		spin_unlock(&amp;kaweth-&gt;device_lock);
+		spin_unlock_irq(&amp;kaweth-&gt;device_lock);
 	}
 
 	if(kaweth-&gt;net) {
</pre></body></html>