From: Felipe Balbi <balbi@kernel.org>
To: "He\, Bo" <bo.he@intel.com>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb\@vger.kernel.org" <linux-usb@vger.kernel.org>
Cc: "gregkh\@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"peter.chen\@nxp.com" <peter.chen@nxp.com>,
"k.opasiak\@samsung.com" <k.opasiak@samsung.com>,
"stefan\@agner.ch" <stefan@agner.ch>,
"felixhaedicke\@web.de" <felixhaedicke@web.de>,
"colin.king\@canonical.com" <colin.king@canonical.com>,
"rogerq\@ti.com" <rogerq@ti.com>,
"f.fainelli\@gmail.com" <f.fainelli@gmail.com>, "He\,
Bo" <bo.he@intel.com>, "Zhang\, Yanmin" <yanmin.zhang@intel.com>
Subject: Re: [PATCH] usb: gadget: udc: fix the kernel NULL pointer in composite_setup
Date: Tue, 18 Jul 2017 13:44:15 +0300 [thread overview]
Message-ID: <87pocy81og.fsf@linux.intel.com> (raw)
In-Reply-To: <CD6925E8781EFD4D8E11882D20FC406D5280CB9F@SHSMSX104.ccr.corp.intel.com>
Hi,
"He, Bo" <bo.he@intel.com> writes:
> the patch is for fix the below kernel panic:
> BUG: unable to handle kernel NULL pointer dereference at 000000000000002a
> IP: [<ffffffff8170e19d>] composite_setup+0x3d/0x1830
> PGD 27525b067 PUD 27525a067 PMD 0
> Oops: 0002 [#1] PREEMPT SMP
> Call Trace:
> [<ffffffff8168b902>] ? dwc3_trace+0x52/0x60
> [<ffffffff810c504d>] ? get_parent_ip+0xd/0x50
> [<ffffffff8171159c>] android_setup+0xbc/0x140
> [<ffffffff810ec190>] ? irq_finalize_oneshot+0xe0/0xe0
> [<ffffffff816917e7>] dwc3_ep0_delegate_req+0x37/0x50
> [<ffffffff81692e69>] dwc3_ep0_interrupt+0xaf9/0xc10
> [<ffffffff810c504d>] ? get_parent_ip+0xd/0x50
> [<ffffffff810ec190>] ? irq_finalize_oneshot+0xe0/0xe0
> [<ffffffff81690281>] dwc3_thread_interrupt+0x931/0xbf0
> [<ffffffff810ec190>] ? irq_finalize_oneshot+0xe0/0xe0
> [<ffffffff810ec1ae>] irq_thread_fn+0x1e/0x40
> [<ffffffff810ec674>] irq_thread+0x134/0x1b0
> [<ffffffff810ec260>] ? wake_threads_waitq+0x30/0x30
> [<ffffffff810b802d>] kthread+0xed/0x110
> [<ffffffff81a2fd6f>] ret_from_fork+0x3f/0x70
> RIP [<ffffffff8170e19d>] composite_setup+0x3d/0x1830
>
> the root cause is dwc interrupt comes after usb_gadget_remove_driver.
> the fix is stop udc to have the dwc3 disable the interrupt, then release
> the resource in udc->driver->unbind.
> usb_gadget_udc_stop-->
> udc->gadget->ops->udc_stop(udc->gadget)-->
> dwc3_gadget_stop
>
> Signed-off-by: he, bo <bo.he@intel.com>
> ---
> drivers/usb/gadget/udc/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index e6f04ee..67e9aa5 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -1258,8 +1258,8 @@ static void usb_gadget_remove_driver(struct usb_udc *udc)
>
> usb_gadget_disconnect(udc->gadget);
> udc->driver->disconnect(udc->gadget);
> - udc->driver->unbind(udc->gadget);
> usb_gadget_udc_stop(udc);
> + udc->driver->unbind(udc->gadget);
unbind must be called before udc_stop. This seems to be a bug *only* in
dwc3. I can't see how this would happen, actually. On dwc3_gadget_stop()
we mask dwc3's interrupts, so the handler should be executed anymore.
Can you tell me how to reproduce this? I could try this out tomorrow.
Which kernel are you using? I wonder if this is something caused by the
Android patches.
--
balbi
next prev parent reply other threads:[~2017-07-18 10:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-18 9:19 [PATCH] usb: gadget: udc: fix the kernel NULL pointer in composite_setup He, Bo
2017-07-18 10:44 ` Felipe Balbi [this message]
2017-07-19 5:16 ` He, Bo
2017-07-19 7:50 ` Felipe Balbi
2017-07-19 8:13 ` He, Bo
2017-07-19 9:50 ` Felipe Balbi
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=87pocy81og.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=bo.he@intel.com \
--cc=colin.king@canonical.com \
--cc=f.fainelli@gmail.com \
--cc=felixhaedicke@web.de \
--cc=gregkh@linuxfoundation.org \
--cc=k.opasiak@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@nxp.com \
--cc=rogerq@ti.com \
--cc=stefan@agner.ch \
--cc=yanmin.zhang@intel.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 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.