[PATCH 04/11] ALSA: hda: Add NULL check for the driver pointer at unsol event work

From: Takashi Iwai

Date: Thu Oct 08 2026 - 15:29:48 EST


snd_hdac_bus_process_unsol_events() assumes that the codec driver is
always set when it's accessible from the codec table. It's true in
general, but in a sheer timing, it might have been already NULLified
at the driver unbinding.

As a safety, let's add a NULL check before dereferencing and calling
the driver's unsol_event callback.

Fixes: c637fa151259 ("ALSA: hda: Fix potential race in unsol event handler")
Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
---
sound/hda/core/bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/hda/core/bus.c b/sound/hda/core/bus.c
index 8d4ed9834aaa..96fd9bd221c9 100644
--- a/sound/hda/core/bus.c
+++ b/sound/hda/core/bus.c
@@ -184,7 +184,7 @@ static void snd_hdac_bus_process_unsol_events(struct work_struct *work)
continue;
spin_unlock_irq(&bus->reg_lock);
drv = drv_to_hdac_driver(codec->dev.driver);
- if (drv->unsol_event)
+ if (drv && drv->unsol_event)
drv->unsol_event(codec, res);
spin_lock_irq(&bus->reg_lock);
}
--
2.55.0