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] [day] [month] [year] [list]
Message-ID: <f4a65be6-f892-464f-a4c6-5032c1558666@samsung.com>
Date: Mon, 17 Nov 2025 21:19:23 +0530
From: Selvarasu Ganesan <selvarasu.g@...sung.com>
To: Thinh.Nguyen@...opsys.com, gregkh@...uxfoundation.org,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: jh0801.jung@...sung.com, dh10.jung@...sung.com, naushad@...sung.com,
	akash.m5@...sung.com, h10.kim@...sung.com, eomji.oh@...sung.com,
	alim.akhtar@...sung.com, thiagu.r@...sung.com, stable@...r.kernel.org
Subject: Re: [PATCH] usb: dwc3: gadget: Prevent EPs resource conflict during
 StartTransfer


On 11/17/2025 8:58 PM, Selvarasu Ganesan wrote:
> This commit fixes the below warning that occurs when a StartTransfer
> command is issued for bulk or interrupt endpoints in
> `dwc3_gadget_ep_enable` while a previous transfer on the same endpoint
> is still in progress. The gadget functions drivers can invoke
> usb_ep_enable (which triggers a new StartTransfer command) before the
> earlier transfer has completed. Because the previous StartTransfer is
> still active, `dwc3_gadget_ep_disable` can skip the required
> `EndTransfer` due to `DWC3_EP_DELAY_STOP`, leading to  the endpoint
> resources are busy for previous StartTransfer and warning ("No resource
> for ep") from gadget driver.
>
> To resolve this, a check is added to `dwc3_gadget_ep_enable` that
> checks the `DWC3_EP_TRANSFER_STARTED` flag before issuing a new
> StartTransfer. By preventing a second StartTransfer on an already busy
> endpoint, the resource conflict is eliminated, the warning disappears,
> and potential kernel panics caused by `panic_on_warn` are avoided.
>
> ------------[ cut here ]------------
> dwc3 13200000.dwc3: No resource for ep1out
> WARNING: CPU: 0 PID: 700 at drivers/usb/dwc3/gadget.c:398 dwc3_send_gadget_ep_cmd+0x2f8/0x76c
> Call trace:
>   dwc3_send_gadget_ep_cmd+0x2f8/0x76c
>   __dwc3_gadget_ep_enable+0x490/0x7c0
>   dwc3_gadget_ep_enable+0x6c/0xe4
>   usb_ep_enable+0x5c/0x15c
>   mp_eth_stop+0xd4/0x11c
>   __dev_close_many+0x160/0x1c8
>   __dev_change_flags+0xfc/0x220
>   dev_change_flags+0x24/0x70
>   devinet_ioctl+0x434/0x524
>   inet_ioctl+0xa8/0x224
>   sock_do_ioctl+0x74/0x128
>   sock_ioctl+0x3bc/0x468
>   __arm64_sys_ioctl+0xa8/0xe4
>   invoke_syscall+0x58/0x10c
>   el0_svc_common+0xa8/0xdc
>   do_el0_svc+0x1c/0x28
>   el0_svc+0x38/0x88
>   el0t_64_sync_handler+0x70/0xbc
>   el0t_64_sync+0x1a8/0x1ac
>
> Change-Id: Id292265a34448e566ef1ea882e313856423342dc
Required to remove change-id as mistakenly included, and going to post 
new version with remove change-id.
> Fixes: a97ea994605e ("usb: dwc3: gadget: offset Start Transfer latency for bulk EPs")
> Cc: stable@...r.kernel.org
> Signed-off-by: Selvarasu Ganesan <selvarasu.g@...sung.com>
> ---
>   drivers/usb/dwc3/gadget.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f95d1369bbc6..23e5c111da7c 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -951,8 +951,9 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, unsigned int action)
>   	 * Issue StartTransfer here with no-op TRB so we can always rely on No
>   	 * Response Update Transfer command.
>   	 */
> -	if (usb_endpoint_xfer_bulk(desc) ||
> -			usb_endpoint_xfer_int(desc)) {
> +	if ((usb_endpoint_xfer_bulk(desc) ||
> +			usb_endpoint_xfer_int(desc)) &&
> +			!(dep->flags & DWC3_EP_TRANSFER_STARTED)) {
>   		struct dwc3_gadget_ep_cmd_params params;
>   		struct dwc3_trb	*trb;
>   		dma_addr_t trb_dma;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ