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=1796441139; b=To93L7Y+BcaoQspN8pZM9hNLK2XiT9d9fmiDooxw0RJw4eWlX4Cv7ttC/+mkoWoHrOhR yd+jmZn/RVH7p+PkXsZ6y+TjmiXrqJNUDnyoJ1ke3o2AcFiE43u6BV4F6wGXTrdUEAG9j VSXw/5BWVLS5DdU60JK6akP70LJfQ1Uz83vF9ILGD/BEYvnAOoG4aETXGTMA+uefpNKXp 4qQuMbgYCpuO+1QsaRsPI+amP595ky1AWQ6AjIXhq9fKsxbyle/5OB7F0DAxUGoo1LZ8Y zUV/DFdsYrVEhop+3OeNJruiNqAZ7Uf//yG91Vgvpb1pAYhBgf4lWZAD932Nm1pA+ig== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796441139; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=Z8tlRqC1+e7V0VKmbgTz4ZcTYArEVRNAvtbbmd6NzSs=; b=f6AOBhUxaSVnWQf6YViAB/nmKGuZ2W6UnG+D1zdIpHzr/o+Jl25s3GAlF2GbnfzycJ7A Df36bLoyV7pJEyDujmj9mjnTx5Ee8Oi8STxhAd+RwLOuHW3JzEwTO4tfwNcljaPW+hixS TMKYH7UiBRFx2B1qIhUmAcOSZFgDuh99mjXP4mq+d/GjeCUYAnhR7a9X9fO8TK/aySVyv S28lIzBjxN+bz8EZkLBxLeLz4iLma8VVqscMhkNLqSgd8jqz9kotK+bCbXJXKpzMq+JuO e9hCWRZ5XlN5LtnXMwKHGZBvwLqCJkUg09hfRlKgM6OZeffnZumXU+3oG8rK1oN8f0A== 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=CyB7RsA9; 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 50CC4606A322; Sat, 5 Dec 2026 03:25:39 +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=CyB7RsA9 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFC2D1F00936; Sat, 5 Dec 2026 03:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796441138; bh=Z8tlRqC1+e7V0VKmbgTz4ZcTYArEVRNAvtbbmd6NzSs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=CyB7RsA9c7s2IM3XlOz6kHmYrKiwiktvFfXuTLSH6w9SZoIV0WYH+0zPKy9uyivB2 A+vUr2/pz8+dbzMeaecckzsIkiL0EhnqI8av71wGVYY9av6hjUXVUZ7T4oU7OZsD8y 7Je0OEsY4c26bBw8vNRADjl9LYSCbPmumIEoMEYZvscb38ph8BbLs5+2VrSH6e9mcP OfgYa8ViE6IhO1463rz0SmQ14WuBIHmQuQruaYfxi+sK54b5k3ophIfH6sGlvc6B28 iynkHUEr4rWGVgXC+/RteFD+lcpWJobK9CqQGhwyKmWwpLgo7Y9ehkH1cqMgRB2JdV j3/MJ0O7gtxAQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH usb-next] usb: gadget: pxa27x_udc: fix locking in req_done() on PREEMPT_RT Reply-To: sashiko-reviews@lists.linux.dev To: "Xinsheng Zhu" , linux-usb@vger.kernel.org Cc: linux-rt-devel@lists.linux.dev, linux-kernel@vger.kernel.org In-Reply-To: <20261205031306.25065-1-xinsheng.zhu.ny@gmail.com> References: <20261205031306.25065-1-xinsheng.zhu.ny@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 03:25:38 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] usb: gadget: pxa27x_udc: empty ep->lock pairs and unused pflags in req_done() -- commit 15927850a0e1e014c34b3d8d8f2da88f14a342f0 Author: Xinsheng Zhu usb: gadget: pxa27x_udc: fix locking in req_done() on PREEMPT_RT This commit replaces the explicit local_irq_save()/local_irq_restore() calls around usb_gadget_giveback_request() in req_done() with spin_unlock()/spin_lock() on ep->lock, acquiring and releasing ep->lock with spin_lock_irqsave()/spin_unlock_irqrestore() when pflags is NULL. > diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc= /pxa27x_udc.c > index 9fd079cb65c6b..774e50d00d090 100644 > --- a/drivers/usb/gadget/udc/pxa27x_udc.c > +++ b/drivers/usb/gadget/udc/pxa27x_udc.c > @@ -672,13 +672,15 @@ static void req_done(struct pxa_ep *ep, struct pxa2= 7x_request *req, int status, > &req->req, status, > req->req.actual, req->req.length); > =20 > - if (pflags) > - spin_unlock_irqrestore(&ep->lock, *pflags); > - local_irq_save(flags); > + if (!pflags) > + spin_lock_irqsave(&ep->lock, flags); > + > + spin_unlock(&ep->lock); > usb_gadget_giveback_request(&req->udc_usb_ep->usb_ep, &req->req); > - local_irq_restore(flags); > - if (pflags) > - spin_lock_irqsave(&ep->lock, *pflags); > + spin_lock(&ep->lock); > + > + if (!pflags) > + spin_unlock_irqrestore(&ep->lock, flags); > } [Severity: Medium] When pflags is NULL, should req_done() avoid taking and immediately releasing ep->lock twice with no protected code in between? On CONFIG_PREEMPT_RT, spin_lock_irqsave() does not change interrupt state and only acquires a sleeping rt_spin_lock(). Callers passing NULL, such as handle_ep0() and pxa_ep_dequeue(), now add two empty ep->lock cycles that can contend with concurrent queue operations while protecting nothing. Meanwhile, ep_del_request() earlier in req_done() remains outside this lock acquisition; moving it before ep_del_request() (and keeping ep->lock held in pxa_ep_dequeue()) would protect the queue update instead of locking empty regions. Also, *pflags is no longer dereferenced anywhere in req_done() or its wrappers, so keeping unsigned long *pflags as a boolean while its kernel-doc still describes it as saved spinlock flags is misleading. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205031306.2506= 5-1-xinsheng.zhu.ny@gmail.com?part=3D1