]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ALSA: hda/tas2781: Cancel async firmware request at unbind
authorCássio Gabriel <cassiogabrielcontato@gmail.com>
Tue, 5 May 2026 11:18:17 +0000 (08:18 -0300)
committerTakashi Iwai <tiwai@suse.de>
Wed, 6 May 2026 14:37:48 +0000 (16:37 +0200)
TAS2781 HDA I2C and SPI queue RCA firmware loading from component
bind with request_firmware_nowait(). The firmware loader keeps the
callback module pinned and holds a device reference, but the callback
still uses driver-private HDA state.

Component unbind removes controls and DSP state immediately. Later
device removal tears down the TAS2781 private data, including
codec_lock. If the async firmware callback runs after unbind has
started, it can operate on state that is being torn down.

Cancel or synchronize the async firmware request before removing
controls and DSP state. A queued callback is cancelled, and an
already-running callback is allowed to finish before unbind continues.

Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
Fixes: bb5f86ea50ff ("ALSA: hda/tas2781: Add tas2781 hda SPI driver")
Cc: stable@vger.kernel.org
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260505-alsa-hda-tas2781-fw-callback-teardown-v4-2-e7c4bf930dc8@gmail.com
sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
sound/hda/codecs/side-codecs/tas2781_hda_spi.c

index 67240ce184e1a78a15f6bdccedc239550e4a425c..dd1b0cc63ad6cd2d902c1ab8054ccb060497a946 100644 (file)
@@ -588,6 +588,9 @@ static void tas2781_hda_unbind(struct device *dev,
                comp->playback_hook = NULL;
        }
 
+       request_firmware_nowait_cancel(tas_hda->priv->dev, tas_hda->priv,
+                                      tasdev_fw_ready);
+
        tas2781_hda_remove_controls(tas_hda);
 
        tasdevice_config_info_remove(tas_hda->priv);
index 560f2385212dd5155d2b7c41e21a05c4285f0895..522b1bbc0babf04bc230e36f0aad629151d3023b 100644 (file)
@@ -742,6 +742,9 @@ static void tas2781_hda_unbind(struct device *dev, struct device *master,
                comp->playback_hook = NULL;
        }
 
+       request_firmware_nowait_cancel(tas_priv->dev, tas_priv,
+                                      tasdev_fw_ready);
+
        tas2781_hda_remove_controls(tas_hda);
 
        tasdevice_config_info_remove(tas_priv);