From: Reuben Grinberg Date: Sun, 1 Nov 2026 18:49:36 +0000 (-0600) Subject: ucm: avoid relinking cached controls when adding an alias X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=8c8949be7c46bcf339d728d034fcec1a92e78582;p=alsa-lib.git ucm: avoid relinking cached controls when adding an alias uc_mgr_open_ctl() calls uc_mgr_ctl_add() with an existing entry when another device name resolves to the same control card. Adding that entry to ctl_list again corrupts the list and can double-free the control handle during failed UCM import cleanup. Only link entries allocated by this invocation. Existing entries keep their original list membership while their device aliases are added. Closes: https://github.com/alsa-project/alsa-lib/pull/539 Signed-off-by: Reuben Grinberg Signed-off-by: Jaroslav Kysela --- diff --git a/src/ucm/utils.c b/src/ucm/utils.c index d3e7c139..b3691bea 100644 --- a/src/ucm/utils.c +++ b/src/ucm/utils.c @@ -255,7 +255,8 @@ static int uc_mgr_ctl_add(snd_use_case_mgr_t *uc_mgr, goto __nomem; } - list_add_tail(&(*ctl_list)->list, &uc_mgr->ctl_list); + if (cl) + list_add_tail(&(*ctl_list)->list, &uc_mgr->ctl_list); return 0; __nomem: