From: Johan Hovold <johan@kernel.org>
To: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, patong.mxl@gmail.com,
linus.walleij@linaro.org, angelo.dureghello@timesys.com
Subject: Re: [PATCH v5 1/3] usb: serial: Add MaxLinear/Exar USB to Serial driver
Date: Fri, 26 Feb 2021 11:07:07 +0100 [thread overview]
Message-ID: <YDjIS1QTVuy11nhA@hovoldconsulting.com> (raw)
In-Reply-To: <20210225190405.1f796da8@coco.lan>
On Thu, Feb 25, 2021 at 07:04:05PM +0100, Mauro Carvalho Chehab wrote:
> Em Thu, 25 Feb 2021 18:58:20 +0100
> Mauro Carvalho Chehab <mchehab+huawei@kernel.org> escreveu:
> > While testing the xr_serial (as currently merged), I opted to apply
> > the patches on the top of vanilla Kernel 5.11 - as it sounds too risky
> > to use linux-next so early on a new development cycle :-)
> >
> > There, I'm getting an OOPS:
> >
> > [ 30.261291] BUG: kernel NULL pointer dereference, address: 00000000000000a8
> > [ 30.261375] #PF: supervisor write access in kernel mode
> > [ 30.261438] #PF: error_code(0x0002) - not-present page
> > [ 30.261500] PGD 0 P4D 0
> > [ 30.261539] Oops: 0002 [#1] SMP PTI
> > [ 30.261586] CPU: 2 PID: 686 Comm: kworker/2:3 Not tainted 5.11.0+ #14
> > [ 30.261666] Hardware name: /NUC5i7RYB, BIOS RYBDWi35.86A.0380.2019.0517.1530 05/17/2019
> > [ 30.261757] Workqueue: usb_hub_wq hub_event
> > [ 30.261816] RIP: 0010:mutex_lock+0x1e/0x40
> > [ 30.262796] Call Trace:
> > [ 30.262832] usb_serial_disconnect+0x33/0x140
> > [ 30.262897] usb_unbind_interface+0x8c/0x260
> > [ 30.262957] device_release_driver_internal+0x103/0x1d0
> > [ 30.263026] device_release_driver+0x12/0x20
> > [ 30.263083] bus_remove_device+0xe1/0x150
> > [ 30.263140] device_del+0x192/0x3f0
> > [ 30.263188] ? usb_remove_ep_devs+0x1f/0x30
> > [ 30.263244] usb_disable_device+0x95/0x1c0
> > [ 30.263300] usb_disconnect+0xc0/0x270
> > [ 30.263350] hub_event+0xa2e/0x1620
> >
> > After adding this hack:
> >
> > <snip>
> > --- a/drivers/usb/serial/usb-serial.c
> > +++ b/drivers/usb/serial/usb-serial.c
> > @@ -1081,6 +1081,11 @@ static void usb_serial_disconnect(struct usb_interface *interface)
> > struct usb_serial_port *port;
> > struct tty_struct *tty;
> >
> > + if (!serial) {
> > + dev_err(dev, "%s: Serial pointer is NULL!!!\n", __func__);
> > + return;
> > + }
> > +
> > usb_serial_console_disconnect(serial);
> >
> > mutex_lock(&serial->disc_mutex);
> > </snip>
> >
> > It works fine:
> >
> > [ 283.005625] xr_serial 2-1:1.1: xr_serial converter detected
> > [ 283.005868] usb 2-1: xr_serial converter now attached to ttyUSB0
> > [ 283.007284] printk: console [ttyUSB0] enabled
> > [ 284.444419] usb 2-1: USB disconnect, device number 5
> > [ 284.444520] xr_serial 2-1:1.0: usb_serial_disconnect: Serial pointer is NULL!!!
> > [ 284.444894] printk: console [ttyUSB0] disabled
> > [ 284.445091] xr_serial ttyUSB0: xr_serial converter now disconnected from ttyUSB0
> > [ 284.445141] xr_disconnect
> > [ 284.445156] xr_serial 2-1:1.1: device disconnected
> >
> > I'm not sure if the bug is at xr_serial or if it is inside usb-serial.c.
> >
> > Any ideas?
>
> Answering myself, as those devices may have two different interfaces
> (one for control and another one for data), I suspect that the
> driver needs to manually call usb_set_intfdata() after detecting the
> data interface.
Thanks for reporting this.
I'm afraid it's a bit more involved than that; we'd need to add support
to USB-serial core for managing a sibling interface and either one being
disconnected first. This has implications for suspend as well.
I think we should just not claim the control interface for now since it
not currently used by the driver. I'll send a fix.
Johan
next prev parent reply other threads:[~2021-02-26 10:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-22 17:08 [PATCH v5 0/3] Add support for MaxLinear/Exar USB to serial converters Manivannan Sadhasivam
2020-11-22 17:08 ` [PATCH v5 1/3] usb: serial: Add MaxLinear/Exar USB to Serial driver Manivannan Sadhasivam
2021-01-21 10:19 ` Johan Hovold
2021-01-26 15:46 ` Manivannan Sadhasivam
2021-01-26 16:26 ` Johan Hovold
2021-02-22 15:27 ` Mauro Carvalho Chehab
2021-02-22 15:47 ` Johan Hovold
2021-02-24 8:51 ` Mauro Carvalho Chehab
2021-02-25 17:58 ` Mauro Carvalho Chehab
2021-02-25 18:04 ` Mauro Carvalho Chehab
2021-02-26 10:07 ` Johan Hovold [this message]
2021-02-26 10:37 ` Mauro Carvalho Chehab
2020-11-22 17:08 ` [PATCH v5 2/3] usb: serial: xr_serial: Add gpiochip support Manivannan Sadhasivam
2020-12-01 14:37 ` Linus Walleij
2020-12-01 15:51 ` Johan Hovold
2020-12-05 22:21 ` Linus Walleij
2020-12-08 9:58 ` Johan Hovold
2020-12-08 12:41 ` Linus Walleij
2020-12-08 12:52 ` Manivannan Sadhasivam
2020-12-09 15:31 ` Johan Hovold
2020-12-09 15:25 ` Johan Hovold
2020-12-09 16:25 ` Linus Walleij
2020-12-10 8:53 ` Johan Hovold
2020-12-10 9:04 ` Johan Hovold
2020-12-12 0:03 ` Linus Walleij
2020-12-14 8:58 ` Johan Hovold
2020-12-14 9:19 ` Linus Walleij
2020-12-14 9:31 ` Johan Hovold
2020-12-01 18:00 ` Manivannan Sadhasivam
2021-01-21 11:06 ` Johan Hovold
2020-11-22 17:08 ` [PATCH v5 3/3] usb: cdc-acm: Ignore Exar XR21V141X when serial driver is built Manivannan Sadhasivam
2021-01-21 10:23 ` Johan Hovold
2020-12-08 10:51 ` [PATCH v5 0/3] Add support for MaxLinear/Exar USB to serial converters Manivannan Sadhasivam
2020-12-14 9:51 ` Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YDjIS1QTVuy11nhA@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=angelo.dureghello@timesys.com \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mani@kernel.org \
--cc=mchehab+huawei@kernel.org \
--cc=patong.mxl@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®