Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1154442pxb; Fri, 27 Aug 2021 02:29:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSYJk/IekVUxjLR8o5NO51d88uVSoed9J6pjUMGLyBHTHdxEzut9PTA5Q2+HEk/IROzE8T X-Received: by 2002:a92:c8c4:: with SMTP id c4mr2436397ilq.137.1630056592611; Fri, 27 Aug 2021 02:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630056592; cv=none; d=google.com; s=arc-20160816; b=Xq85Dsn15E1eViG3jCLuJFl/mQ0VZMinYiv/Ia3DIrX8GhtvXdXfu9/FRtkP0MyV9O 0/0U/L5flvBDKr+5e5gHleDsPwlXCWl00TPCFSahdm2Y+Ovu9jV+B+l8Arc2jVqesexF /mGlm4bdE8vOxLr+xypZmddWukkT3PYNQewd9zHDpn4IjYvrG4PnjoPishC8gYpT9Vua WA4d/fSKrDqf7XA3uNuOGONnezvBR8nKbXerBFS6gem0ZY7+HZKsJ3gARlRXiB6yPyJy cFOcbDq/vWTve4/GvsEdFYUDn35UuMrMxpS+IzgUaBXX2BzHfGzdIbiAAyyh22tCEieo KZig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:in-reply-to:date:subject :cc:to:from:user-agent:references:dkim-signature; bh=5lo+c75WITWGVsOXanb8PiJWTJUpIoissKR9quVbi4U=; b=cVi6ZRQqBb+eAevf2Bx2ZhyjhaET8Tq5Iq1Rrz1JWFPGP1lTbfwgjMlB4RQFNv/XRS V0Jw3c67RKRcnd6UmPm7bM+OSyxlek5NMP8eUSKANQ6yoI8KDEz7fe169eBSen+qxhnV GjGZRn3ZxJkyFkCKyNL6e67SAyZIQFBMXhlo7fNv6Dl3bOJkJ4/H1H5ILqb8MBxO8Ebs JtzA6TqKCeaXp56XCeu6xrYkGBNMIowcynXaBWEYcNsNJ+oAmpz2+csLY1WtZxTeB/Ea rptAFXz+62j7ZX8VRZzCEbKjUKzofywngSTrNyWd75TVrCVN5OKZXqm5i6XYuoil1CKp vjOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=wjW+g+aW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si5308548jaj.101.2021.08.27.02.29.40; Fri, 27 Aug 2021 02:29:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=wjW+g+aW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244725AbhH0J3o (ORCPT + 99 others); Fri, 27 Aug 2021 05:29:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244657AbhH0J3m (ORCPT ); Fri, 27 Aug 2021 05:29:42 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21494C061757 for ; Fri, 27 Aug 2021 02:28:54 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id i6so9434507wrv.2 for ; Fri, 27 Aug 2021 02:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=5lo+c75WITWGVsOXanb8PiJWTJUpIoissKR9quVbi4U=; b=wjW+g+aWTIDrNPkQ5Hk0RyoHOuL+2avJKZtQxUV7lm/BHWLktYY3RS6eBRcrof2CKl sseeXG/wsdpJ6BXY+Yd7HNE6ZEsenXc55m6E6h9qVXiaIy+mIgNXWRsXd+vACnxHkf8f 0aoZ8UVVvgWPP9y7TLXKNkdJem6Yzhj6wqiT44k2/A92ECqqBf+ThV9bD2/TtKDdYD8u xdnuo130INgil6XQFbQ+SGzIbfNWs3Jb3mir3q0SlAzwFIjc/MdnloyEuUVitAr53swS NYyZmCEPVj9nGWw/BCRRcPGWZiX+AHSsqTzR3rD4pQQaJ4Lc4pI9HbmbPTnXq5vZmn0o ri9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=5lo+c75WITWGVsOXanb8PiJWTJUpIoissKR9quVbi4U=; b=idpoCzpEGJJ3B1YkRJavzPBIGBjnxM84JBxh+nLpowAXA3kdOzXztu+dkUjKONKYCv xG6UxaHeNKF9SO00DDmHUGiBhnPUlblF03784jYto/N/0F/mZenViIV9nfbcnMSjeX5+ P4B0OW9YPY8494uOeju65t5wbdoSaMhbQSqqj8Q76eFXvRYy0P8aL8ESHywtkHGpLUK3 pWIlrpF6NJ7xDzyqKYYlLKU0uDTtttryHEvn2GxN8GFMWYaqmWfASTsNuR6NJyr8cZVj O1VBYmTsPHgkZPusBs9W4h5pN8etmCOJg915vgh9QQg/49/3V2AvFIQqHSlpyWDLLZfX U/zg== X-Gm-Message-State: AOAM532y6g18ILaYD56PrvqDpBoXAX4rDH8tRSe+ke5VSEuJvf/aWL6r KUTtUor4nDeKb0qdOhgNxATDCXri0mIFjA== X-Received: by 2002:adf:c38c:: with SMTP id p12mr2068576wrf.113.1630056532752; Fri, 27 Aug 2021 02:28:52 -0700 (PDT) Received: from localhost (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id q17sm5815463wrr.91.2021.08.27.02.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 02:28:52 -0700 (PDT) References: <20210827075853.266912-1-jbrunet@baylibre.com> <87a6l39us6.fsf@kernel.org> User-agent: mu4e 1.6.4; emacs 27.1 From: Jerome Brunet To: Felipe Balbi Cc: Ruslan Bilovol , Pavel Hofman , Greg Kroah-Hartman , Jack Pham , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Thinh Nguyen , Ferry Toth Subject: Re: [PATCH] usb: gadget: f_uac2: fixup feedback endpoint stop Date: Fri, 27 Aug 2021 11:26:57 +0200 In-reply-to: <87a6l39us6.fsf@kernel.org> Message-ID: <1jfsuvw817.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 27 Aug 2021 at 11:05, Felipe Balbi wrote: > Hi, > > Jerome Brunet writes: > >> When the uac2 function is stopped, there seems to be an issue reported on >> some platforms (Intel Merrifield at least) >> >> BUG: kernel NULL pointer dereference, address: 0000000000000008 >> ... >> RIP: 0010:dwc3_gadget_del_and_unmap_request+0x19/0xe0 >> ... >> Call Trace: >> dwc3_remove_requests.constprop.0+0x12f/0x170 >> __dwc3_gadget_ep_disable+0x7a/0x160 >> dwc3_gadget_ep_disable+0x3d/0xd0 >> usb_ep_disable+0x1c/0x70 >> u_audio_stop_capture+0x79/0x120 [u_audio] >> afunc_set_alt+0x73/0x80 [usb_f_uac2] >> composite_setup+0x224/0x1b90 [libcomposite] >> >> The issue happens only when the gadget is using the sync type "async", not >> "adaptive". This indicates that problem is coming from the feedback >> endpoint, which is only used with async synchronization mode. >> >> The problem is that request is freed regardless of usb_ep_dequeue(), which >> ends up badly if the request is not actually dequeued yet. >> >> Update the feedback endpoint free function to release the endpoint the same >> way it is done for the data endpoint, which takes care of the problem. >> >> Reported-by: Ferry Toth >> Tested-by: Ferry Toth >> Signed-off-by: Jerome Brunet >> --- >> Hi Felipe, >> >> This solves the issue reported here [0] and makes revert [1] >> unnecessary. > > awesome work! Thanks > > Acked-by: Felipe Balbi Forgot the fixes tag Fixes: 24f779dac8f3 ("usb: gadget: f_uac2/u_audio: add feedback endpoint support")