Re: [RE-RESEND PATCH 1/4] usb: musb: Fix runtime PM race in musb_queue_resume_work

From
Paul Cercueil <paul@crapouillou.net>
Date
2021-01-24 09:01:29
Also in
linux-mips, lkml, stable
Reply to
Sergei Shtylyov, 2021-01-23
Hi Sergei,


Le sam. 23 janv. 2021 à 19:41, Sergei Shtylyov [off-list ref] a écrit :
On 1/23/21 5:24 PM, Paul Cercueil wrote:
quoted
 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. :-)
Oops. Hopefully Bin or Greg can fix it when merging (if I don't need to v2, that is to say - feedback welcome).

Cheers,
-Paul
quoted
 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 [off-list ref]
 Reviewed-by: Tony Lindgren [off-list ref]
 Tested-by: Tony Lindgren [off-list ref]
[...]


MBR, Sergei
  
Thread (6 messages) 6 messages, 2 authors, last reply 2021-01-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help