The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: Daniel Mack <zonque@gmail.com>, Takashi Iwai <tiwai@suse.de>,
	Jaroslav Kysela <perex@perex.cz>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	Bin Yu <byu@xidian.edu.cn>, Cheng Wen <wencheng@xidian.edu.cn>
Subject: Re: [PATCH v2] ALSA: caiaq: Serialize audio stream start and stop
Date: Sun, 06 Dec 2026 12:07:21 +0100	[thread overview]
Message-ID: <87cxresm52.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261205171946.8410-1-25031212351@stu.xidian.edu.cn>

On Sat, 05 Dec 2026 18:19:46 +0100,
YuanZhe Liu wrote:
> 
> The caiaq PCM driver shares a single "streaming" flag and one set of
> isochronous URBs among all substreams, but stream_start() and
> stream_stop() are not serialized.  The PCM core allows prepare() to run
> concurrently for the playback and capture substreams, and close() may
> run concurrently as well.
> 
> stream_stop() clears cdev->streaming before it kills the URBs.  A
> concurrent prepare() then sees streaming == 0 and starts submitting the
> same URBs while they are still active or being killed.  This triggers
> "URB ... submitted while active" in usb_submit_urb() and returns
> -EBUSY, or -EPERM when the URB is being killed.
> 
> In addition, when stream_start() fails part-way, it only clears the
> flag and leaves the already submitted URBs active.  The following
> stream_stop() becomes a no-op, and the next prepare() resubmits the
> still-active URBs, hitting the same warning.
> 
> Serialize the stream state machine with a mutex and stop the stream
> when a submit fails, following the same pattern as the usb6fire
> driver.
> 
> Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support")
> Co-developed-by: Bin Yu <byu@xidian.edu.cn>
> Signed-off-by: Bin Yu <byu@xidian.edu.cn>
> Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
> Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>

Applied to for-next branch.  Thanks.


Takashi

      reply	other threads:[~2026-12-06 11:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 17:19 [PATCH v2] ALSA: caiaq: Serialize audio stream start and stop YuanZhe Liu
2026-12-06 11:07 ` 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=87cxresm52.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=25031212351@stu.xidian.edu.cn \
    --cc=byu@xidian.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=wencheng@xidian.edu.cn \
    --cc=zonque@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