All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Praneeth Balasubramanian" <praneethb2002@gmail.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: pxa27x_udc: Keep ep->lock while queueing on ep0
Date: Fri, 04 Dec 2026 19:21:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-250528@kernel.org> (raw)
In-Reply-To: <20261204185128.1688263-1-praneethb2002@gmail.com>

> pxa_ep_queue() adds the request to ep->queue under ep->lock, drops the
> lock, and then runs the ep0 data stage: it writes or reads the ep0 FIFO,
> completes the request, or removes it again with ep_del_request() on an
> unexpected state. ep_del_request() is documented as "Context: ep->lock
> held". The ep0 interrupt path, handle_ep0(), works on the same queue
> and FIFO. When a gadget queues on ep0 from process context, as FunctionFS
> or a UVC gadget does after a delayed setup reply, interrupts are on and
> the UDC interrupt can run handle_ep0() in the middle of this sequence.
> 
> The ep0 block ran under the lock until commit 5e23e90f3388 ("USB:
> pxa27x_udc: Fix deadlocks on request queueing"). That commit released
> the lock before it to avoid a deadlock when a completion handler queues
> a new request, and noted that ep0 still needed a proper fix. req_done()
> can already drop the lock around the completion when it gets the flags,
> as nuke() and handle_ep() use it.
> 
> Keep ep->lock held for the ep0 block and pass &flags to the completion
> helpers, so the lock is still released while the gadget's completion
> runs. A 2017 RFC took the lock in the same way for the OUT data stage.
> 
> The missing lock was found by a static check that turns the locking rule
> in a function's comment into a Clang context-analysis requirement on its
> callers.
> 
> Link: https://lore.kernel.org/all/7670be97-1199-3c5c-8959-4b982d0fb9cf@tul.cz/
> Fixes: 5e23e90f3388 ("USB: pxa27x_udc: Fix deadlocks on request queueing")
> Cc: stable@vger.kernel.org
> Signed-off-by: Praneeth Balasubramanian <praneethb2002@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204185128.1688263-1-praneethb2002@gmail.com?part=1

      reply	other threads:[~2026-12-04 19:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 18:51 [PATCH] usb: gadget: pxa27x_udc: Keep ep->lock while queueing on ep0 Praneeth Balasubramanian
2026-12-04 19:21 ` sashiko-bot [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=sashiko-outbox-250528@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=praneethb2002@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.