From: Peter Chen <hzpeterchen@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Nicolai Stange <nicstange@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Peter Chen <peter.chen@freescale.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
Rob Herring <robh@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Geliang Tang <geliangtang@163.com>,
Stefan Koch <stefan.koch10@gmail.com>,
Viresh Kumar <viresh.kumar@linaro.org>,
Tomeu Vizoso <tomeu.vizoso@collabora.com>,
Oliver Neukum <oneukum@suse.com>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] usb/core: usb_alloc_dev(): fix setting of ->portnum
Date: Sun, 20 Mar 2016 19:00:31 +0800 [thread overview]
Message-ID: <20160320110031.GA30461@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1603181013020.1866-100000@iolanthe.rowland.org>
On Fri, Mar 18, 2016 at 10:13:34AM -0400, Alan Stern wrote:
> On Thu, 17 Mar 2016, Nicolai Stange wrote:
>
> > With commit 69bec7259853 ("USB: core: let USB device know device node"),
> > the port1 argument of usb_alloc_dev() gets overwritten as follows:
> >
> > ... usb_alloc_dev(..., unsigned port1)
> > {
> > ...
> > if (!parent->parent) {
> > port1 = usb_hcd_find_raw_port_number(..., port1);
> > }
> > ...
> > }
> >
> > Later on, this now overwritten port1 gets assigned to ->portnum:
> >
> > dev->portnum = port1;
> >
> > However, since xhci_find_raw_port_number() isn't idempotent, the
> > aforementioned commit causes a number of KASAN splats like the following:
>
> ...
>
> > Fix this by not overwriting the port1 argument in usb_alloc_dev(), but
> > storing the raw port number as required by OF in an additional variable,
> > raw_port.
> >
> > Fixes: 69bec7259853 ("USB: core: let USB device know device node")
> > Signed-off-by: Nicolai Stange <nicstange@gmail.com>
> > ---
> > Applicable to linux-next-20160317
> >
> > Changes to v1:
> > - Initialize raw_port with port1
>
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
>
Thanks for fixing it in time, you are right. My patch would let the
device logical port number equals to device raw port number, but it
is wrong for xhci.
--
Best Regards,
Peter Chen
prev parent reply other threads:[~2016-03-20 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 22:53 [PATCH v2] usb/core: usb_alloc_dev(): fix setting of ->portnum Nicolai Stange
2016-03-18 14:13 ` Alan Stern
2016-03-20 11:00 ` Peter Chen [this message]
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=20160320110031.GA30461@shlinux2.ap.freescale.net \
--to=hzpeterchen@gmail.com \
--cc=arnd@arndb.de \
--cc=geliangtang@163.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nicstange@gmail.com \
--cc=oneukum@suse.com \
--cc=p.zabel@pengutronix.de \
--cc=peter.chen@freescale.com \
--cc=robh@kernel.org \
--cc=stefan.koch10@gmail.com \
--cc=stern@rowland.harvard.edu \
--cc=tomeu.vizoso@collabora.com \
--cc=viresh.kumar@linaro.org \
/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