From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796412082; b=wxQQdCaSzK/LHrkyXvSgBUErpJ7W+PW7l0vIARhhqAr0uFfiHcMNv9TgFMs20TF6ddAT 1qWI1GFyr55GqS7Zvy1IBg9YiGNNawYUI2lyec72PWZy+ud4RyumD7rxlWnHkzf5EqISb RVOLaIaeewZfC5IJ6iBtD6Ey3IXRw4iyMRmx958QhEZe/v0vSlqpqDvNnmWClPavZP4i4 wkizcASNHV5IHwfbutyTnmXGm9o+3tzhIyWDJuzHTZfZGyRaH+NJxWqXKr++2WGLJid8s +7AQbw7J5ixZt3PTXzV8KNEwHO2ChG0+p4Gq2eKoX77X/m9LT6CHWUl0X6wL8pGd/Ag== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796412082; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=dInQZPuhXvt6quXp9xAp9JV5z80kvLDv8KE+cQogJSA=; b=VfFwoZNH06favcHm/syOca5cIjEY/Tvy0kknei61TVBro0g9G+NxYExzOGFz/MZ3WF6x 5Dxp14K0U4ZPzXcSCbuwiDcP035F5EMuBM+eKiBkiwEWZq6CHI1d1wof19L2x56Ms4ubD 3RIlC1zYsGeBt8StYdmE9IHq7/dDBtrsgP15I8SzPCtIDbxrRUOJnCVbAv+dPrgPldt2S tinDPABC3SrOoLiLoxMy1E7qkjM74msU3My0i1iFqmF+lv01JpL0XqipIokbpIWg3APpg piu7wWBR1fZvmvVpiL4IlVyp1FtnGoBgCI5sjwcnQ+qLjPUBpsd2wEEIgQzHIxJP5kQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GFs0Khj5; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B66A606A333 for ; Fri, 4 Dec 2026 19:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=GFs0Khj5 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F99E1F00936; Fri, 4 Dec 2026 19:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796412082; bh=dInQZPuhXvt6quXp9xAp9JV5z80kvLDv8KE+cQogJSA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=GFs0Khj5Anozb3bBOCtlMZUYQBXj+pyUC9/MoH6sbSkhNj9c7L8apccB0ybxH9EGk 3HhqUslBNboK8yVtxR9I2yHqem/TajCwkuDwz981wmnZ5hSFyFGef4oNAwFW09oZX5 g12yX4tILJML8KY/olGM9dKrYm1q0k0YqsPD/yBm1klhfbpgefHUJrD/e4VK1nYzgh fflG+cBo+OP1DJJhiWwxFMuPHbZmIUd7rdAJPT7K/QJnSNwx6mIAJ9HKLnhmlWQgKR hAuPUkIBMO5IYcgl23+pYeR+jiD7RFbJ4IFQaTL2Xiwn1oDjPtksjKtNaskXh8ElJD JGhiZG2vA51mw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] usb: gadget: pxa27x_udc: Keep ep->lock while queueing on ep0 Reply-To: sashiko-reviews@lists.linux.dev To: "Praneeth Balasubramanian" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261204185128.1688263-1-praneethb2002@gmail.com> References: <20261204185128.1688263-1-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 19:21:21 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > 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. >=20 > 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. >=20 > 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. >=20 > 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. >=20 > Link: https://lore.kernel.org/all/7670be97-1199-3c5c-8959-4b982d0fb9cf@tu= l.cz/ > Fixes: 5e23e90f3388 ("USB: pxa27x_udc: Fix deadlocks on request queueing") > Cc: stable@vger.kernel.org > Signed-off-by: Praneeth Balasubramanian Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204185128.1688= 263-1-praneethb2002@gmail.com?part=3D1