aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/hda.c
diff options
context:
space:
mode:
authorCezary Rojewski <cezary.rojewski@intel.com>2022-07-06 14:02:26 +0200
committerTakashi Iwai <tiwai@suse.de>2022-07-15 16:26:50 +0200
commite7255c00b10e5e570dd8eb24f59e964eeec38d3b (patch)
tree683616d9489b7085e3454a3233ef116eb486411d /sound/soc/codecs/hda.c
parentALSA: hda: cs35l41: Add module parameter to control firmware load (diff)
downloadlinux-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.c4
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);