* [PATCH 1/2] hso: fix for crash when unplugging the device
@ 2009-04-02 8:57 Jan Dumon
2009-04-02 23:32 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jan Dumon @ 2009-04-02 8:57 UTC (permalink / raw)
To: David Miller
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
From: Jan Dumon <j.dumon-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
Changed the order in which things are freed. This fixes an oops when
unplugging the device while network traffic is ongoing.
Signed-off-by: Jan Dumon <j.dumon-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
---
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 28d1424..779a007 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -5,6 +5,7 @@
* Copyright (C) 2008 Option International
* Filip Aben <f.aben-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
* Denis Joseph Barrow <d.barow-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
+ * Jan Dumon <j.dumon-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
* Copyright (C) 2007 Andrew Bird (Sphere Systems Ltd)
* <ajb-5+cxppFmGx6/3pe1ocb+s/XRex20P6io@public.gmane.org>
* Copyright (C) 2008 Greg Kroah-Hartman <gregkh-l3A5Bk7waGM@public.gmane.org>
@@ -2417,20 +2418,22 @@ static void hso_free_net_device(struct hso_device *hso_dev)
if (!hso_net)
return;
+ remove_net_device(hso_net->parent);
+
+ if (hso_net->net) {
+ unregister_netdev(hso_net->net);
+ free_netdev(hso_net->net);
+ }
+
/* start freeing */
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]);
kfree(hso_net->mux_bulk_rx_buf_pool[i]);
+ hso_net->mux_bulk_rx_buf_pool[i] = NULL;
}
usb_free_urb(hso_net->mux_bulk_tx_urb);
kfree(hso_net->mux_bulk_tx_buf);
-
- remove_net_device(hso_net->parent);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] hso: fix for crash when unplugging the device
2009-04-02 8:57 [PATCH 1/2] hso: fix for crash when unplugging the device Jan Dumon
@ 2009-04-02 23:32 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-04-02 23:32 UTC (permalink / raw)
To: j.dumon-x9gZzRpC1QbQT0dZR+AlfA
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
From: Jan Dumon <j.dumon-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
Date: Thu, 2 Apr 2009 10:57:20 +0200
> Changed the order in which things are freed. This fixes an oops when
> unplugging the device while network traffic is ongoing.
>
> Signed-off-by: Jan Dumon <j.dumon-x9gZzRpC1QbQT0dZR+AlfA@public.gmane.org>
Applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-04-02 23:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-02 8:57 [PATCH 1/2] hso: fix for crash when unplugging the device Jan Dumon
2009-04-02 23:32 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).