From: Francesco Dolcini <francesco@dolcini.it>
To: Linux regressions mailing list <regressions@lists.linux.dev>
Cc: Alistair <alistair@alistair23.me>,
Badhri Jagan Sridharan <badhri@google.com>,
gregkh@linuxfoundation.org, stern@rowland.harvard.edu,
colin.i.king@gmail.com, xuetao09@huawei.com,
quic_eserrao@quicinc.com, water.zhangjiantao@huawei.com,
peter.chen@freescale.com, balbi@ti.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, Francesco Dolcini <francesco@dolcini.it>
Subject: Re: [PATCH v4 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started
Date: Wed, 17 May 2023 12:35:57 +0200 [thread overview]
Message-ID: <ZGStr1oZvmJ0XzSu@francesco-nb.int.toradex.com> (raw)
In-Reply-To: <1ac16f0a-3cca-40ca-c444-82719f85a24c@leemhuis.info>
On Wed, May 17, 2023 at 12:23:39PM +0200, Linux regression tracking (Thorsten Leemhuis) wrote:
> [CCing Francesco Dolcini; and the regression list too, as it should be
> in the loop for regressions:
> https://docs.kernel.org/admin-guide/reporting-regressions.html]
>
> On 16.05.23 14:53, Alistair wrote:
> > On Fri, 2023-04-07 at 03:07 +0000, Badhri Jagan Sridharan wrote:
> >> usb_udc_connect_control does not check to see if the udc has already
> >> been started. This causes gadget->ops->pullup to be called through
> >> usb_gadget_connect when invoked from usb_udc_vbus_handler even before
> >> usb_gadget_udc_start is called. Guard this by checking for udc-
> >>> started
> >> in usb_udc_connect_control before invoking usb_gadget_connect.
> > [...]
> >> Cc: stable@vger.kernel.org
> >> Fixes: 628ef0d273a6 ("usb: udc: add usb_udc_vbus_handler")
> >> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> >
> > This patch causes a kernel hang when trying to boot with the
> > usb/chipidea/udc.c driver.
> >
> > The call stack below causes the hang:
> >
> > - gadget_bind_driver(struct device *dev)
> > - mutex_lock(&udc->connect_lock);
> > - usb_gadget_udc_start_locked(struct usb_udc *udc)
> > - udc->gadget->ops->udc_start(udc->gadget, udc->driver)
> >
> > At which point we are calling ci_udc_start(..), but with the
> > connect_lock mutex locked.
> >
> > ci_udc_start() then calls usb_udc_vbus_handler() which tries to lock
> > the connect_lock while it's already locked. Resulting in a kernel hang.
> >
> > Reverting this patch fixes the hang.
>
> Not my area of expertise, but I guess it might be the same error as this
> one:
>
> https://lore.kernel.org/all/ZF4BvgsOyoKxdPFF@francesco-nb.int.toradex.com/
>
> Francesco sent a revert on Friday, but no reaction from Badhri Jagan
> Sridharan or Greg yet afaics.
>
> https://lore.kernel.org/all/20230512131435.205464-1-francesco@dolcini.it/
Revert patches were applied and are in linux-next. I expect those to
land in Linus tree with the next pull request from Greg.
Francesco
next prev parent reply other threads:[~2023-05-17 10:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-07 3:07 [PATCH v4 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started Badhri Jagan Sridharan
2023-04-07 3:07 ` [PATCH v4 2/2] usb: gadget: udc: core: Prevent redundant calls to pullup Badhri Jagan Sridharan
2023-05-16 12:53 ` [PATCH v4 1/2] usb: gadget: udc: core: Invoke usb_gadget_connect only when started Alistair
2023-05-17 10:23 ` Linux regression tracking (Thorsten Leemhuis)
2023-05-17 10:32 ` Badhri Jagan Sridharan
2023-05-17 10:35 ` Francesco Dolcini [this message]
2023-05-17 10:56 ` Linux regression tracking (Thorsten Leemhuis)
2023-05-17 17:45 ` Badhri Jagan Sridharan
2023-05-30 21:50 ` Avichal Rakesh
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=ZGStr1oZvmJ0XzSu@francesco-nb.int.toradex.com \
--to=francesco@dolcini.it \
--cc=alistair@alistair23.me \
--cc=badhri@google.com \
--cc=balbi@ti.com \
--cc=colin.i.king@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=peter.chen@freescale.com \
--cc=quic_eserrao@quicinc.com \
--cc=regressions@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=water.zhangjiantao@huawei.com \
--cc=xuetao09@huawei.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