LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Jerome Brunet <jbrunet@baylibre.com>
Cc: Ruslan Bilovol <ruslan.bilovol@gmail.com>,
	Pavel Hofman <pavel.hofman@ivitera.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jack Pham <jackp@codeaurora.org>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
	Ferry Toth <ftoth@exalondelft.nl>
Subject: Re: [PATCH] usb: gadget: f_uac2: fixup feedback endpoint stop
Date: Fri, 27 Aug 2021 11:05:38 +0300	[thread overview]
Message-ID: <87a6l39us6.fsf@kernel.org> (raw)
In-Reply-To: <20210827075853.266912-1-jbrunet@baylibre.com>


Hi,

Jerome Brunet <jbrunet@baylibre.com> 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 <ftoth@exalondelft.nl>
> Tested-by: Ferry Toth <ftoth@exalondelft.nl>
> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
> ---
>  Hi Felipe,
>
>  This solves the issue reported here [0] and makes revert [1]
>  unnecessary.

awesome work! Thanks

Acked-by: Felipe Balbi <balbi@kernel.org>

-- 
balbi

  reply	other threads:[~2021-08-27  8:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  7:58 Jerome Brunet
2021-08-27  8:05 ` Felipe Balbi [this message]
2021-08-27  9:26   ` Jerome Brunet
  -- strict thread matches above, loose matches on Subject: below --
2021-08-24 20:14 [PATCH v1 1/3] Revert "usb: gadget: u_audio: add real feedback implementation" Ferry Toth
2021-08-25  9:21 ` [PATCH] usb: gadget: f_uac2: fixup feedback endpoint stop Jerome Brunet
2021-08-25 20:07   ` Ferry Toth
2021-08-25 21:42     ` Thinh Nguyen
2021-08-26  7:25       ` Jerome Brunet
2021-08-27  0:50         ` Thinh Nguyen
2021-08-27  8:38           ` Jerome Brunet
2021-08-27 23:30             ` Thinh Nguyen
2021-08-26  7:23     ` Jerome Brunet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6l39us6.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=ftoth@exalondelft.nl \
    --cc=gregkh@linuxfoundation.org \
    --cc=jackp@codeaurora.org \
    --cc=jbrunet@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pavel.hofman@ivitera.com \
    --cc=ruslan.bilovol@gmail.com \
    --subject='Re: [PATCH] usb: gadget: f_uac2: fixup feedback endpoint stop' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).