mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Cen Zhang <zzzccc427@gmail.com>
Cc: perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, baijiaju1990@gmail.com,
	jjzuming@gmail.com
Subject: Re: [PATCH] ALSA: ump: Drain sequencer callbacks before freeing their client
Date: Sun, 25 Oct 2026 08:56:04 +0100	[thread overview]
Message-ID: <87o6ci6wob.wl-tiwai@suse.de> (raw)
In-Reply-To: <pm-pmb-00625126b81966d1bf1d-v2-915f6bbabe1fd458c3ab@gmail.com>

On Sat, 24 Oct 2026 10:02:47 +0200,
Cen Zhang wrote:
> 
> seq_ump_client_free() cancels group_notify_work while the endpoint still
> publishes seq_ops and seq_client. A received Function Block update can
> enter the sequencer callback after cancellation and queue the work again.
> Even disabling the work cannot protect a callback that already loaded
> seq_client and then resumes after the client has been freed.
> 
> A USB UMP endpoint can continue receiving while its sequencer binding
> is removed. The following order uses the same endpoint and client:
> 
>   Sequencer binding removal             UMP input completion
>   -------------------------             --------------------
>   cancel_work_sync()
>                                         load seq_ops and seq_client
>   delete sequencer client
>   clear endpoint binding
>   kfree(client)
>                                         schedule group_notify_work
>                                         read client->seq_client
> 
> Cover all calls through seq_ops with SRCU in the UMP core. Withdraw the
> operations pointer and wait for those callbacks before canceling work
> and deleting the client. No producer can then queue work after the final
> cancellation, and both the client and callback code remain available
> until the last in-flight callback returns.
> 
> Publish seq_ops with release/acquire ordering so the separately stored
> seq_client is initialized before any callback uses it. Use SRCU because
> sequencer notification delivery can sleep; no callback needs to change
> its existing execution context or allocation behavior.
> 
> Fixes: 4a16a3af0571 ("ALSA: seq: ump: Handle FB info update")
> Assisted-by: LLM
> Signed-off-by: Cen Zhang <zzzccc427@gmail.com>

Applied now.  Thanks.


Takashi

      reply	other threads:[~2026-10-25  7:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24  8:02 Cen Zhang
2026-10-25  7:56 ` Takashi Iwai [this message]

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=87o6ci6wob.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=baijiaju1990@gmail.com \
    --cc=jjzuming@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=zzzccc427@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®