diff options
author | 2022-07-06 14:02:26 +0200 | |
---|---|---|
committer | 2022-07-15 16:26:50 +0200 | |
commit | e7255c00b10e5e570dd8eb24f59e964eeec38d3b (patch) | |
tree | 683616d9489b7085e3454a3233ef116eb486411d /sound/soc/codecs/hda.c | |
parent | ALSA: hda: cs35l41: Add module parameter to control firmware load (diff) | |
download | linux-dev-e7255c00b10e5e570dd8eb24f59e964eeec38d3b.tar.xz linux-dev-e7255c00b10e5e570dd8eb24f59e964eeec38d3b.zip |
ALSA: hda: Skip event processing for unregistered codecs
When codec is unbound but not yet removed, in the eyes of
snd_hdac_bus_process_unsol_events() it is still a valid target to
delegate work to. Such behaviour may lead to use-after-free errors.
Address by verifying if codec is actually registered.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220706120230.427296-6-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc/codecs/hda.c')
-rw-r--r-- | sound/soc/codecs/hda.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/soc/codecs/hda.c b/sound/soc/codecs/hda.c index edcb8bc6806b..ad20a3dff9b7 100644 --- a/sound/soc/codecs/hda.c +++ b/sound/soc/codecs/hda.c @@ -274,7 +274,7 @@ static void hda_codec_remove(struct snd_soc_component *component) struct hdac_device *hdev = &codec->core; struct hdac_bus *bus = hdev->bus; struct hdac_ext_link *hlink; - bool was_registered = codec->registered; + bool was_registered = codec->core.registered; /* Don't allow any more runtime suspends */ pm_runtime_forbid(&hdev->dev); @@ -376,7 +376,7 @@ static int hda_hdev_detach(struct hdac_device *hdev) { struct hda_codec *codec = dev_to_hda_codec(&hdev->dev); - if (codec->registered) + if (codec->core.registered) cancel_delayed_work_sync(&codec->jackpoll_work); snd_soc_unregister_component(&hdev->dev); |