lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2025062825-equipment-barista-dabc@gregkh>
Date: Sat, 28 Jun 2025 17:23:39 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: SCHNEIDER Johannes <johannes.schneider@...ca-geosystems.com>
Cc: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
	Pengutronix Kernel Team <kernel@...gutronix.de>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	GEO-CHHER-bsp-development <bsp-development.geo@...ca-geosystems.com>
Subject: Re: [PATCH v3] usb: dwc3: gadget: Simplify TRB reclaim logic by
 removing redundant 'chain' argument

On Wed, Jun 25, 2025 at 07:53:17AM +0000, SCHNEIDER Johannes wrote:
> Now that the TRB reclaim logic always inspects the TRB's CHN (Chain) bit
> directly to determine whether a TRB is part of a chain, the explicit
> 'chain' parameter passed into dwc3_gadget_ep_reclaim_completed_trb()
> is no longer necessary.
> 
> This cleanup simplifies the reclaim code by avoiding duplication of
> chain state tracking, and makes the reclaim logic rely entirely on the
> hardware descriptor flags — which are already present and accurate at
> this stage.
> 
> No functional changes intended.
> 
> Signed-off-by: Johannes Schneider <johannes.schneider@...ca-geosystems.com>
> Acked-by: Thinh Nguyen <Thinh.Nguyen@...opsys.com>
> ---
> v3: no changes, re-submission as single patch
> v2: no changes to the patch, "faulty" re-submission
> v1: initial submission as part of a series
> Link: https://lore.kernel.org/lkml/AM8PR06MB7521CFF1CD8A93622A537EEDBC78A@AM8PR06MB7521.eurprd06.prod.outlook.com/
> 
>  drivers/usb/dwc3/gadget.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 99fbd29d8f46..a4a2bf273f94 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -3497,7 +3497,7 @@ static void dwc3_gadget_free_endpoints(struct dwc3 *dwc)
>  
>  static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
>  		struct dwc3_request *req, struct dwc3_trb *trb,
> -		const struct dwc3_event_depevt *event, int status, int chain)
> +		const struct dwc3_event_depevt *event, int status)
>  {
>  	unsigned int		count;
>  
> @@ -3549,7 +3549,8 @@ static int dwc3_gadget_ep_reclaim_completed_trb(struct dwc3_ep *dep,
>  	if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
>  		return 1;
>  
> -	if (event->status & DEPEVT_STATUS_SHORT && !chain)
> +	if (event->status & DEPEVT_STATUS_SHORT &&
> +	    !(trb->ctrl & DWC3_TRB_CTRL_CHN))
>  		return 1;
>  
>  	if ((trb->ctrl & DWC3_TRB_CTRL_ISP_IMI) &&
> @@ -3576,8 +3577,7 @@ static int dwc3_gadget_ep_reclaim_trb_sg(struct dwc3_ep *dep,
>  		trb = &dep->trb_pool[dep->trb_dequeue];
>  
>  		ret = dwc3_gadget_ep_reclaim_completed_trb(dep, req,
> -				trb, event, status,
> -				!!(trb->ctrl & DWC3_TRB_CTRL_CHN));
> +				trb, event, status);
>  		if (ret)
>  			break;
>  	}
> -- 
> 2.43.0
> 

Applying just this patch I get:

  CC [M]  drivers/usb/dwc3/gadget.o
drivers/usb/dwc3/gadget.c: In function ‘dwc3_gadget_ep_reclaim_completed_trb’:
drivers/usb/dwc3/gadget.c:3517:13: error: ‘chain’ undeclared (first use in this function)
 3517 |         if (chain && (trb->ctrl & DWC3_TRB_CTRL_HWO))
      |             ^~~~~
drivers/usb/dwc3/gadget.c:3517:13: note: each undeclared identifier is reported only once for each function it appears in

So that's not going to work :(


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ