Re: [PATCH v2] ALSA: jack: Fix jack control cleanup on error paths
From: Takashi Iwai
Date: Mon Nov 16 2026 - 10:46:16 EST
On Sun, 15 Nov 2026 12:43:15 +0100,
Sreeraj S Kurup wrote:
>
> snd_jack_new() creates an ALSA jack control before allocating
> the jack structure.
>
> If a later allocation or device registration fails, the
> function returns without removing the previously created
> control. This leaves the control attached to the sound card
> and can cause invalid list operations during card teardown.
>
> Initialize the control list in snd_jack_kctl_new() so that
> the private_free callback can safely remove the list entry.
>
> Route all failure paths in snd_jack_new() through common
> cleanup labels to remove the control and free allocated
> resources.
>
> Fixes: 4e3f0dc65883 ("ALSA: jack: extend snd_jack_new to support phantom jack")
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@xxxxxxxxx>
Applied to for-next branch now, as it's no urgent fix that can trigger
a crash or such.
thanks,
Takashi