* HSO driver patch [1/2]
@ 2016-10-07 14:29 Matej Kupljen
[not found] ` <CAHMF36FfubzNOcaud613oVuM4YZoC_y29GtMC_h7HDNLOSm8Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Matej Kupljen @ 2016-10-07 14:29 UTC (permalink / raw)
To: Greg KH; +Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2591 bytes --]
Hi,
I am using hso driver for my 3G modem (although different manufacturer
with different USB VID/PID) but I have some problems with it. It is
working fine, but if you disconnect the USB connection while the data
is transferring trough AT interface, we get a crash.
There are two patches:
1.) 0001-Reverse-the-order-in-disconnect.patch
This patch first sets the interface to NULL and only then starts
removing the allocated
resources. This is according to documentation and it is also
more similar to other drivers.
2.) 0002-Stop-also-serial-queue-when-device-is-unplugged.patch
Serial device was not stopped when the device got unplugged so
there are continues error
messages that the URB cannot be submitted.
Another problem is that we can hit the WARN macro in hso_serial_open by:
1.) Plug in the USB modem
2.) Load hso.ko module
3.) Create the /dev nodes
4.) do a less -f /dev/ttyHS2
5.) unplug the USB modem
6.) Re-plug it and back
7.) Quit previous less by pressing q
8.) start less again like in 4 and you'll get
[ 198.828136] ------------[ cut here ]------------
[ 198.832788] WARNING: CPU: 2 PID: 1799 at include/linux/kref.h:47
kobject_get+0x9c/0xa8()
[ 198.840886] Modules linked in: hso
[ 198.844337] CPU: 2 PID: 1799 Comm: less Not tainted
4.1.13-00130-g126c250-dirty #5
[ 198.851917] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[ 198.858481] [<80017b70>] (unwind_backtrace) from [<800137d0>]
(show_stack+0x10/0x14)
[ 198.866246] [<800137d0>] (show_stack) from [<8063caa0>]
(dump_stack+0x84/0xc4)
[ 198.873492] [<8063caa0>] (dump_stack) from [<8002857c>]
(warn_slowpath_common+0x84/0xb4)
[ 198.881597] [<8002857c>] (warn_slowpath_common) from [<80028648>]
(warn_slowpath_null+0x1c/0x24)
[ 198.890398] [<80028648>] (warn_slowpath_null) from [<802533a8>]
(kobject_get+0x9c/0xa8)
[ 198.898420] [<802533a8>] (kobject_get) from [<80110b90>] (cdev_get+0x2c/0x4c)
[ 198.905571] [<80110b90>] (cdev_get) from [<80110eb0>]
(chrdev_open+0x2c/0x178)
[ 198.912812] [<80110eb0>] (chrdev_open) from [<8010aff0>]
(do_dentry_open+0x1d8/0x2f8)
[ 198.920666] [<8010aff0>] (do_dentry_open) from [<80118958>]
(do_last+0x564/0xce4)
[ 198.928164] [<80118958>] (do_last) from [<8011b0fc>] (path_openat+0x80/0x5cc)
[ 198.935330] [<8011b0fc>] (path_openat) from [<8011c0f8>]
(do_filp_open+0x2c/0x88)
[ 198.942832] [<8011c0f8>] (do_filp_open) from [<8010c36c>]
(do_sys_open+0x108/0x1cc)
[ 198.950508] [<8010c36c>] (do_sys_open) from [<80010140>]
(ret_fast_syscall+0x0/0x60)
[ 198.958292] ---[ end trace d0b32f14e1047616 ]---
Thanks,
Matej
[-- Attachment #2: 0001-Reverse-the-order-in-disconnect.patch --]
[-- Type: text/x-patch, Size: 981 bytes --]
From f560b127ca9bb7c52106f0f83091e6c5e0e90b09 Mon Sep 17 00:00:00 2001
From: Matej Kupljen <matej.kupljen@norik.si>
Date: Wed, 28 Sep 2016 18:37:23 +0200
Subject: [PATCH] Reverse the order in disconnect
When the device is disconnected, we first need to set interface
data to NULL and then do the freeing of resources to avoid race
conditions.
Signed-off-by: Matej Kupljen <matej.kupljen@norik.si>
---
drivers/net/usb/hso.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index b0df61f..16aef06 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -3013,10 +3013,10 @@ exit:
/* device removed, cleaning up */
static void hso_disconnect(struct usb_interface *interface)
{
- hso_free_interface(interface);
-
/* remove reference of our private data */
usb_set_intfdata(interface, NULL);
+
+ hso_free_interface(interface);
}
static void async_get_intf(struct work_struct *data)
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: HSO driver patch [1/2]
[not found] ` <CAHMF36FfubzNOcaud613oVuM4YZoC_y29GtMC_h7HDNLOSm8Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2016-10-07 14:38 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2016-10-07 14:38 UTC (permalink / raw)
To: Matej Kupljen
Cc: linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA
On Fri, Oct 07, 2016 at 04:29:42PM +0200, Matej Kupljen wrote:
> Hi,
>
>
> I am using hso driver for my 3G modem (although different manufacturer
> with different USB VID/PID) but I have some problems with it. It is
> working fine, but if you disconnect the USB connection while the data
> is transferring trough AT interface, we get a crash.
>
> There are two patches:
> 1.) 0001-Reverse-the-order-in-disconnect.patch
> This patch first sets the interface to NULL and only then starts
> removing the allocated
> resources. This is according to documentation and it is also
> more similar to other drivers.
> 2.) 0002-Stop-also-serial-queue-when-device-is-unplugged.patch
> Serial device was not stopped when the device got unplugged so
> there are continues error
> messages that the URB cannot be submitted.
Again, patches can not be attached, they just need to be inline, with
the needed information.
Look at the patches on the mailing lists for plenty of examples of how
to do this.
thanks,
greg k-h
--
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:[~2016-10-07 14:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-07 14:29 HSO driver patch [1/2] Matej Kupljen
[not found] ` <CAHMF36FfubzNOcaud613oVuM4YZoC_y29GtMC_h7HDNLOSm8Ew-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-10-07 14:38 ` Greg KH
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.