Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	Bin Yu <byu@xidian.edu.cn>, Cheng Wen <wencheng@xidian.edu.cn>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/2] ALSA: hwdep: Serialize DSP load requests
Date: Sat, 31 Oct 2026 17:00:52 +0100	[thread overview]
Message-ID: <87zevtrhaj.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261029084810.21910-2-25031212351@stu.xidian.edu.cn>

On Thu, 29 Oct 2026 09:48:09 +0100,
YuanZhe Liu wrote:
> 
> The check of the loaded DSP indices and the call of the driver's
> dsp_load callback in snd_hwdep_dsp_load() are not serialized.  A hwdep
> file descriptor can be shared among threads, or inherited across fork,
> so two SNDRV_HWDEP_IOCTL_DSP_LOAD requests for the same index can both
> observe the index as unloaded and enter the driver's callback
> concurrently, even though the device itself is opened exclusively.
> 
> This breaks the assumption behind hw->dsp_loaded that a firmware index
> is loaded only once.  For example, snd-usb-usx2y hits
> WARN_ON(usx2y->as04.buffer) in usx2y_async_seq04_init() and may
> allocate the US-428 sequence URBs twice.
> 
> Serialize the check, the callback invocation and the bookkeeping with a
> per-hwdep mutex, so that the second request returns -EBUSY.
> 
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> 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 this one.  Thanks.


Takashi

  reply	other threads:[~2026-10-31 16:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29  8:48 [PATCH 0/2] ALSA: fix a user-triggerable WARN on repeated DSP load YuanZhe Liu
2026-10-29  8:48 ` [PATCH 1/2] ALSA: hwdep: Serialize DSP load requests YuanZhe Liu
2026-10-31 16:00   ` Takashi Iwai [this message]
2026-10-29  8:48 ` [PATCH 2/2] ALSA: usx2y: Avoid WARN on a repeated DSP load YuanZhe Liu
2026-10-31 16:00   ` Takashi Iwai
2026-10-31 17:16     ` [PATCH v2] ALSA: usx2y: Release the URBs when the DSP load fails YuanZhe Liu
2026-10-31 17:27       ` sashiko-bot
2026-10-31 18:56     ` [PATCH v3] " YuanZhe Liu
2026-10-31 19:07       ` sashiko-bot
2026-10-31 19:15     ` [PATCH v4] ALSA: usx2y: Refuse a retried DSP load after a failure YuanZhe Liu
2026-11-01 15:33       ` Takashi Iwai
2026-10-30 17:36 ` [PATCH 0/2] ALSA: fix a user-triggerable WARN on repeated DSP load YuanZhe Liu

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=87zevtrhaj.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=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=wencheng@xidian.edu.cn \
    /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