From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CEC421B185 for ; Fri, 14 Feb 2025 08:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739523282; cv=none; b=ss+2gMIYdXvzvfAEzugz/pSAOng6bX/NcfppH1MYB0sx7EvdWytMgI/kYEwcRp85LUkwQuzDoUHhxKR5+ah/j2nRp8Dr55RXRYP/RZ0xBwEApVqKxbEIqFyiGcrASKiHepgEpsCmeVbZTXRVgnYFdI3BU6D4CFjpv6n2cl3UsJQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739523282; c=relaxed/simple; bh=nottMoCa8aOV6cZJrL7jEgHZtPVKHpnlgSU38rOQ4Rc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bLHsB7dur3sOleboL0qFSikc+DG6orz+ZIu+menoFaZIjIz2PJCUDIebbGNg1zQ4mwjQwwoIHXdj7sX/iKmjSLeq+u98gx4ejukfhxRSRU1O85eerPcaGvTOwLNwHqKtidzVUIXw4L/3yfXM8BD8gJAlXMzMlrd24P/IlUoJobw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=F+c3cKgJ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="F+c3cKgJ" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 51E5MRvT032643 for ; Fri, 14 Feb 2025 08:54:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= oj8Yee1gTVBAR2OBaCaP5WIbxHVmvmbfZUuTZOcJOb0=; b=F+c3cKgJcLJCsO7V dgCJtO3SX5tsVp+RlrPGgFkVEJrOR8xqtAkpjPir+M6c6iFwpX5EmUrsG9De5bH8 hv3GFCTKM/OOUmk/K6QgcTegivoktt/tbpo0OjojviWkBb+F+CaURrdhm0NmPNZ+ 2L8oXk/EdjaoexbU2FzUm8VxZIaRbcwxNwGaQnkO0J7hdI7qoJ4HTp1D5gsRr8DV vyo5H1pDwEWMdlE+mPFXAn5uAz7MEx76h0AEjfd5ZgDxfC7pAU+fmpL2qj6pw/sj ZcD5t26lmfkDWBAgTfg9qVL0oh591nSEq1cYIecY9vFTyrwdNxTcCMjXsa3jjXq3 BdB2Kg== Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44sc7bbghp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 14 Feb 2025 08:54:38 +0000 (GMT) Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-21f6890d42dso60740485ad.0 for ; Fri, 14 Feb 2025 00:54:38 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739523277; x=1740128077; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oj8Yee1gTVBAR2OBaCaP5WIbxHVmvmbfZUuTZOcJOb0=; b=btThLXw5lff46jd3Cwl287+6Tw2jNrtx8Js92fz8eV5r5dC8BNGHguhV0QTgDsN7iD /jmZXXJGyywDKjvNz3T/xaFght/yCdxesofJGbrHBdTdMfqx+yIj5EIZhPAR9UyUGcNg 68DiL92uhOigwhrQU/V0eaLSj5rYEYEtSLQAWEc2Vk7gRs412o/bQZnNkD6Ot4SLW2Hf pTZlENxgKZrzv6zd8jldTOIXDHoQnMu1hSxygOoeQ7WbWmRnW32yRQGPq/fL24UObQ7H mWRCZ/6DXMjB1CkAZrzER98OXxrxX5UvLFF5IiDHr+eNMmuEUej5s0EAR7Acpaa8gumd 23hg== X-Forwarded-Encrypted: i=1; AJvYcCVxiD9POzOJsfey1m8AbiNvOt26cyTnj8cKNyn8sHoytWs9lVTqz3jt4LsGYgU0qmUxUo46NvtMa4YRYWA=@vger.kernel.org X-Gm-Message-State: AOJu0YxtGc85MEtfJwjTIbeE7cI7221Py+4Qmz8Fzg3eETf6Q6c0PwmT gLsrUFQZUpPxJb46Ne598o9fbjVs2DWUNMPqOXPofKzPfCWExllm9L81lfk2kRo0ocJWRsbCobs oqKoZjJg+QCojb7exhmsHqi1O8wkrJLPl5HkZrit288sw9xvNPu4ZmdQfRF+D9yg= X-Gm-Gg: ASbGnctKkDArGnIenNgfdLpX8IzokjUi+S9pD5nem9d2uuY3c8xbWEDhRQ5YFyVgFn+ UMRPoXTNcS/bhNR/RamK5JMM2mvCFGW5hG+lOk9F4/RaGJECbBIocJMdvztEmuxgS99MBLJj81X j6c6xqL8Oo1kMRjGi7VxyAsh9jtpBeC60QF4dXnrpyxqp4evCusbwHn5J0DdCE51h7/L3ez+OqO KTSCt2HMaNwBSiFYyrvLQpf0e4pTugxOlr0WYtaxyZRRwhVBl3u6vGMQK8DwmywyHOWuq5cI1vg b7RSEdyGEoG/QDV9nP6oJbIk32utqA== X-Received: by 2002:a17:903:189:b0:216:4d1f:5c83 with SMTP id d9443c01a7336-220d2170847mr95303765ad.47.1739523277212; Fri, 14 Feb 2025 00:54:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8WQ+Q0P3Hp8eId28DGCMDHWq1vMwRmUui9erU8zLhPW/BTEuxaCh7jaJut82nv5+tq8vQUA== X-Received: by 2002:a17:903:189:b0:216:4d1f:5c83 with SMTP id d9443c01a7336-220d2170847mr95303455ad.47.1739523276763; Fri, 14 Feb 2025 00:54:36 -0800 (PST) Received: from [10.218.35.239] ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-220d545c8e7sm24344555ad.122.2025.02.14.00.54.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Feb 2025 00:54:36 -0800 (PST) Message-ID: Date: Fri, 14 Feb 2025 14:24:31 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails To: Greg Kroah-Hartman Cc: Ferry Toth , Ricardo B Marliere , Kees Cook , linux-usb@vger.kernel.org, Elson Roy Serrao , linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20250212100840.3812153-1-prashanth.k@oss.qualcomm.com> <2025021436-seizing-prankish-ebf2@gregkh> Content-Language: en-US From: Prashanth K In-Reply-To: <2025021436-seizing-prankish-ebf2@gregkh> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: Xe-4CErGFGgpUcbsQy5iZVW7aUC-E3tK X-Proofpoint-GUID: Xe-4CErGFGgpUcbsQy5iZVW7aUC-E3tK X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-02-14_03,2025-02-13_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxlogscore=834 phishscore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 bulkscore=0 mlxscore=0 malwarescore=0 clxscore=1015 impostorscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2501170000 definitions=main-2502140063 On 14-02-25 01:30 pm, Greg Kroah-Hartman wrote: > On Wed, Feb 12, 2025 at 03:38:40PM +0530, Prashanth K wrote: >> Currently while UDC suspends, u_ether attempts to remote wakeup >> the host if there are any pending transfers. However, if remote >> wakeup fails, the UDC remains suspended but the is_suspend flag >> is not set. And since is_suspend flag isn't set, the subsequent >> eth_start_xmit() would queue USB requests to suspended UDC. >> >> To fix this, bail out from gether_suspend() only if remote wakeup >> operation is successful. >> >> Cc: stable@vger.kernel.org >> Fixes: 0a1af6dfa077 ("usb: gadget: f_ecm: Add suspend/resume and remote wakeup support") >> Signed-off-by: Prashanth K >> --- >> drivers/usb/gadget/function/u_ether.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c >> index 09e2838917e2..f58590bf5e02 100644 >> --- a/drivers/usb/gadget/function/u_ether.c >> +++ b/drivers/usb/gadget/function/u_ether.c >> @@ -1052,8 +1052,8 @@ void gether_suspend(struct gether *link) >> * There is a transfer in progress. So we trigger a remote >> * wakeup to inform the host. >> */ >> - ether_wakeup_host(dev->port_usb); >> - return; >> + if (!ether_wakeup_host(dev->port_usb)) >> + return; > > What about the other place in the driver where this function is called > but the return value is ignored? > > thanks, > > greg k-h Other than above one, eth_start_xmit() tries to remote wakeup host when we have some data to send from n/w layer. In that case we try to wakeup host and directly return NETDEV_TX_BUSY to caller. If remote wakeup succeeds, then resume() would call netif_start_queue() which again lets n/w layer to queue skb. Hence we don't have to check for ret of ether_wakeup_host() in that case. Regards, Prashanth K