Commit d23b536b authored by Herbert Xu's avatar Herbert Xu Committed by Linus Torvalds

[PATCH] USB: fix race in kaweth disconnect

this patch from Herbert Xu fixes a race by moving termination of
the URBs into close() exclusively.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarOliver Neukum <oliver@neukum.name>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8845add3
...@@ -219,7 +219,6 @@ struct kaweth_device ...@@ -219,7 +219,6 @@ struct kaweth_device
__u32 status; __u32 status;
int end; int end;
int removed;
int suspend_lowmem_rx; int suspend_lowmem_rx;
int suspend_lowmem_ctrl; int suspend_lowmem_ctrl;
int linkstate; int linkstate;
...@@ -699,6 +698,7 @@ static int kaweth_close(struct net_device *net) ...@@ -699,6 +698,7 @@ static int kaweth_close(struct net_device *net)
usb_kill_urb(kaweth->irq_urb); usb_kill_urb(kaweth->irq_urb);
usb_kill_urb(kaweth->rx_urb); usb_kill_urb(kaweth->rx_urb);
usb_kill_urb(kaweth->tx_urb);
flush_scheduled_work(); flush_scheduled_work();
...@@ -750,13 +750,6 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net) ...@@ -750,13 +750,6 @@ static int kaweth_start_xmit(struct sk_buff *skb, struct net_device *net)
spin_lock(&kaweth->device_lock); spin_lock(&kaweth->device_lock);
if (kaweth->removed) {
/* our device is undergoing disconnection - we bail out */
spin_unlock(&kaweth->device_lock);
dev_kfree_skb_irq(skb);
return 0;
}
kaweth_async_set_rx_mode(kaweth); kaweth_async_set_rx_mode(kaweth);
netif_stop_queue(net); netif_stop_queue(net);
...@@ -1136,10 +1129,6 @@ static void kaweth_disconnect(struct usb_interface *intf) ...@@ -1136,10 +1129,6 @@ static void kaweth_disconnect(struct usb_interface *intf)
return; return;
} }
netdev = kaweth->net; netdev = kaweth->net;
kaweth->removed = 1;
usb_kill_urb(kaweth->irq_urb);
usb_kill_urb(kaweth->rx_urb);
usb_kill_urb(kaweth->tx_urb);
kaweth_dbg("Unregistering net device"); kaweth_dbg("Unregistering net device");
unregister_netdev(netdev); unregister_netdev(netdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment