FAILED: patch "[PATCH] ALSA: usx2y: Refuse a retried DSP load after a failure" failed to apply to 5.10-stable tree
Subsystems (2)
Sasha Levin
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x 1f8101b6adc87a3ddbd51fcb6609251591758026
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 1f8101b6adc87a3ddbd51fcb6609251591758026 Mon Sep 17 00:00:00 2001
From: YuanZhe Liu <[email protected]>
Date: Sun, 1 Nov 2026 03:15:57 +0800
Subject: [PATCH] ALSA: usx2y: Refuse a retried DSP load after a failure
snd_usx2y_hwdep_dsp_load() sets up the asynchronous sequence URBs and the interrupt URB when the FPGA firmware image with index 1 is loaded, and then creates the ALSA devices. If usx2y_in04_init() or usx2y_create_alsa_devices() fails, the URBs that were already set up are left in place.
The core keeps the index unloaded when the callback fails, so user space may issue the same request again. The second attempt then enters usx2y_async_seq04_init() or usx2y_in04_init() with the URBs still allocated and trips WARN_ON(usx2y->as04.buffer) or WARN_ON(usx2y->in04_urb).
The URBs cannot be released at this point: the card may already have registered PCM devices that user space can still open, and the disconnect handler accesses the URBs without holding the DSP lock. Mark the chip as hung instead, so that a retried request is refused with -ENODEV and the assertions keep their meaning. The URBs are released by snd_usx2y_card_private_free() when the card is freed.
A failing usx2y_async_seq04_init() still releases its own URBs, so that path remains retryable.
--- sound/usb/usx2y/usX2Yhwdep.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/usb/usx2y/usX2Yhwdep.c +5 -0
@@ -179,6 +179,9 @@ static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw,int lret, err;char *buf; +if (priv->chip_status &USX2Y_STAT_CHIP_HUP ) +return -ENODEV ; + buf =memdup_user (dsp->image, dsp->length);if (IS_ERR (buf))return PTR_ERR (buf);
@@ -201,11 +204,13 @@ static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw, err =usx2y_in04_init (priv);if (err) {dev_err (&dev->dev,"usx2y_in04_init error\n" ); + priv->chip_status |=USX2Y_STAT_CHIP_HUP ;return err; } err =usx2y_create_alsa_devices (hw->card);if (err) {dev_err (&dev->dev,"usx2y_create_alsa_devices error %i\n" , err); + priv->chip_status |=USX2Y_STAT_CHIP_HUP ;return err; } priv->chip_status |=USX2Y_STAT_CHIP_INIT ;
Signature · 1 line
2.53.0
PATCH 1/1 ALSA: usx2y: Refuse a retried DSP load after a failure
snd_usx2y_hwdep_dsp_load() sets up the asynchronous sequence URBs and the interrupt URB when the FPGA firmware image with index 1 is loaded, and then creates the ALSA devices. If usx2y_in04_init() or usx2y_create_alsa_devices() fails, the URBs that were already set up are left in place.
The core keeps the index unloaded when the callback fails, so user space may issue the same request again. The second attempt then enters usx2y_async_seq04_init() or usx2y_in04_init() with the URBs still allocated and trips WARN_ON(usx2y->as04.buffer) or WARN_ON(usx2y->in04_urb).
The URBs cannot be released at this point: the card may already have registered PCM devices that user space can still open, and the disconnect handler accesses the URBs without holding the DSP lock. Mark the chip as hung instead, so that a retried request is refused with -ENODEV and the assertions keep their meaning. The URBs are released by snd_usx2y_card_private_free() when the card is freed.
A failing usx2y_async_seq04_init() still releases its own URBs, so that path remains retryable.
In 5.10 a failure of usx2y_create_alsa_devices() frees the card, so there is no retry to refuse on that path and only usx2y_in04_init() is marked as hung here.
--- sound/usb/usx2y/usX2Yhwdep.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/usb/usx2y/usX2Yhwdep.c +4 -0
@@ -193,6 +193,9 @@ static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw,int lret, err;char *buf; +if (priv->chip_status &USX2Y_STAT_CHIP_HUP ) +return -ENODEV ; +snd_printdd ("dsp_load %s\n" , dsp->name); buf =memdup_user (dsp->image, dsp->length);
@@ -217,6 +220,7 @@ static int snd_usx2y_hwdep_dsp_load(struct snd_hwdep *hw, err =usx2y_in04_init (priv);if (err) {snd_printk (KERN_ERR "usx2y_in04_init error\n" ); + priv->chip_status |=USX2Y_STAT_CHIP_HUP ;return err; } err =usx2y_create_alsa_devices (hw->card);
Signature · 1 line
2.34.1
Re: [PATCH 5.10.y] ALSA: usx2y: Refuse a retried DSP load after a failure
Quoted 1 line
[PATCH 5.10.y] ALSA: usx2y: Refuse a retried DSP load after a failure
Queued for 6.1, 5.15 and 5.10, thanks.
Signature · 2 lines
Thanks, Sasha