Patches for hso driver
Subsystems (4)
Hi,
I've found some problems in the hso driver for Option HSxPA devices.
The first and most important are 2 memory leaks in the buffer cleanup routines. Have a look at the "hso-memleak.patch" file to see what I mean.
ATTENTION:
-------------------------------------------------------------------------------------
kmemleak still finds 1 remaining leak, but i can't find it:
unreferenced object 0xce461130 (size 32):
comm "khubd", pid 1105, jiffies 17464
backtrace:
[<c10745b6>] create_object+0xe6/0x210 [<c10747d7>] kmemleak_alloc+0x27/0x60 [<c1071b0d>] kmem_cache_alloc+0xcd/0x120 [<d0ba29a7>] hso_create_net_device+0x207/0x420 [hso] [<d0ba30c7>] hso_probe+0x417/0x690 [hso] [<d0998103>] usb_probe_interface+0x83/0x170 [usbcore] [<c113f9e2>] driver_probe_device+0x62/0x140 [<c113fb81>] __device_attach+0x41/0x50 [<c113f098>] bus_for_each_drv+0x48/0x70 [<c113fc2d>] device_attach+0x6d/0x80 [<c113eeed>] bus_probe_device+0x1d/0x40 [<c113da66>] device_add+0x436/0x4f0 [<d0997654>] usb_set_configuration+0x424/0x5c0 [usbcore] [<d099e68e>] generic_probe+0x2e/0xa0 [usbcore] [<d09979cf>] usb_probe_device+0x1f/0x30 [usbcore] [<c113f9e2>] driver_probe_device+0x62/0x140
Maybe anyone else have an idea for that.
-------------------------------------------------------------------------------------
The second patch "hso-disable_net.patch" stops the useless creation of an serial ttyHS<x> for the Network Port, when disable_net=1 is set. By that, the order of the ttyHS<x> is always the same, regardless if disable_net is set or not.
Best Regards,
Martin
Subject: memory leak in hso driver
This patches fixes 2 memory leaks in the hso driver.
The first problem is, that the tx_buffer of a serial device will never be freed. The second one is, that hso_net is also freed by free_netdev(). So, the rx urbs and buffers must be freed before free_netdev().
drivers/net/usb/hso.c +5 -1
@@ -2312,6 +2312,7 @@ static void hso_serial_common_free(struct hso_serial *serial)/* unlink and free TX URB */ usb_free_urb (serial->tx_urb);kfree (serial->tx_data); +kfree (serial->tx_buffer); } static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
@@ -2438,7 +2439,6 @@ static void hso_free_net_device(struct hso_device *hso_dev)if (hso_net->net) {unregister_netdev (hso_net->net); -free_netdev (hso_net->net); }/* start freeing */
@@ -2451,6 +2451,10 @@ static void hso_free_net_device(struct hso_device *hso_dev)kfree (hso_net->mux_bulk_tx_buf); hso_net->mux_bulk_tx_buf =NULL ; +if (hso_net->net) { +free_netdev (hso_net->net); + } +kfree (hso_dev); }
Subject: Fix interface order when disabled_net=1 in hso driver
This patch stops the useless creation of an serial ttyHS<x> for the Network Port, when disable_net=1 is set. By that, the order of the ttyHS<x> is always the same, regardless if disable_net is set or not.
drivers/net/usb/hso.c +3 -2
@@ -2993,9 +2993,10 @@ static int hso_probe(struct usb_interface *interface,case HSO_INTF_BULK :/* It's a regular bulk interface */ -if (((port_spec &HSO_PORT_MASK ) ==HSO_PORT_NETWORK ) - && !disable_net) +if ((port_spec &HSO_PORT_MASK ) ==HSO_PORT_NETWORK ) { +if (!disable_net) hso_dev =hso_create_net_device (interface, port_spec); + }else hso_dev =hso_create_bulk_serial_device (interface, port_spec);
David Miller
maintainerFrom: "Martin Schiller" <[email protected]>
Date: Wed, 18 Nov 2009 08:35:30 +0100
Quoted 1 line
Have a look at the "hso-memleak.patch" file to see what I mean.
Hmmm...
Please make sure this all works properly, considering the games that hso_kick_transmit() plays wherein it swaps ->tx_data and ->tx_buffer every packet send.
Also, please submit your patches sperately and numbered with changelog and signoffs specific to each change as described in linux/Documentation/SubmittingPatches
Thanks.