summaryrefslogtreecommitdiff
path: root/sound/hda/hdac_bus.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/hda/hdac_bus.c
parent622f21994506e1dac7b8e4e362c8951426e032c5 (diff)
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/hda/hdac_bus.c')
-rw-r--r--sound/hda/hdac_bus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/hda/hdac_bus.c b/sound/hda/hdac_bus.c
index 71db8592b33d..d497414a5538 100644
--- a/sound/hda/hdac_bus.c
+++ b/sound/hda/hdac_bus.c
@@ -183,7 +183,7 @@ static void snd_hdac_bus_process_unsol_events(struct work_struct *work)
if (!(caddr & (1 << 4))) /* no unsolicited event? */
continue;
codec = bus->caddr_tbl[caddr & 0x0f];
- if (!codec || !codec->dev.driver)
+ if (!codec || !codec->registered)
continue;
spin_unlock_irq(&bus->reg_lock);
drv = drv_to_hdac_driver(codec->dev.driver);