From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Paul Cercueil <paul@crapouillou.net>, Bin Liu <b-liu@ti.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Tony Lindgren <tony@atomide.com>,
od@zcrc.me, linux-mips@vger.kernel.org,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [RE-RESEND PATCH 1/4] usb: musb: Fix runtime PM race in musb_queue_resume_work
Date: Sat, 23 Jan 2021 19:41:48 +0300 [thread overview]
Message-ID: <72e48343-f87e-5fed-809c-41995197019e@gmail.com> (raw)
In-Reply-To: <20210123142502.16980-1-paul@crapouillou.net>
On 1/23/21 5:24 PM, Paul Cercueil wrote:
> musb_queue_resume_work() would call the provided callback if the runtime
> PM status was 'active'. Otherwise, it would enqueue the request if the
> hardware was still suspended (musb->is_runtime_suspended is true).
>
> This causes a race with the runtime PM handlers, as it is possible to be
> in the case where the runtime PM status is not yet 'active', but the
> hardware has been awaken (PM resume function has been called).
Awakened. :-)
> When hitting the race, the resume work was not enqueued, which probably
> triggered other bugs further down the stack. For instance, a telnet
> connection on Ingenic SoCs would result in a 50/50 chance of a
> segmentation fault somewhere in the musb code.
>
> Rework the code so that either we call the callback directly if
> (musb->is_runtime_suspended == 0), or enqueue the query otherwise.
>
> Fixes: ea2f35c01d5e ("usb: musb: Fix sleeping function called from invalid context for hdrc glue")
> Cc: stable@vger.kernel.org # v4.9+
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> Reviewed-by: Tony Lindgren <tony@atomide.com>
> Tested-by: Tony Lindgren <tony@atomide.com>
[...]
MBR, Sergei
next prev parent reply other threads:[~2021-01-23 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-23 14:24 [RE-RESEND PATCH 1/4] usb: musb: Fix runtime PM race in musb_queue_resume_work Paul Cercueil
2021-01-23 14:25 ` [RE-RESEND PATCH 2/4] usb: musb: Fix NULL check on struct musb_request field Paul Cercueil
2021-01-23 14:25 ` [RE-RESEND PATCH 3/4] usb: musb: dma: Remove unused variable Paul Cercueil
2021-01-23 14:25 ` [RE-RESEND PATCH 4/4] usb: musb: jz4740: Add missing CR to error strings Paul Cercueil
2021-01-23 16:41 ` Sergei Shtylyov [this message]
2021-01-24 8:38 ` [RE-RESEND PATCH 1/4] usb: musb: Fix runtime PM race in musb_queue_resume_work Paul Cercueil
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=72e48343-f87e-5fed-809c-41995197019e@gmail.com \
--to=sergei.shtylyov@gmail.com \
--cc=b-liu@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=od@zcrc.me \
--cc=paul@crapouillou.net \
--cc=stable@vger.kernel.org \
--cc=tony@atomide.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