Re: [PATCH v4] ALSA: usx2y: Refuse a retried DSP load after a failure
From: Takashi Iwai
Date: Sun Nov 01 2026 - 10:34:02 EST
On Sat, 31 Oct 2026 20:15:57 +0100,
YuanZhe Liu wrote:
>
> 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.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@xxxxxxxxxxxxxxx
> Co-developed-by: Bin Yu <byu@xxxxxxxxxxxxx>
> Signed-off-by: Bin Yu <byu@xxxxxxxxxxxxx>
> Co-developed-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
> Signed-off-by: Cheng Wen <wencheng@xxxxxxxxxxxxx>
> Signed-off-by: YuanZhe Liu <25031212351@xxxxxxxxxxxxxxxxx>
Applied now. Thanks.
Takashi