From 8c8949be7c46bcf339d728d034fcec1a92e78582 Mon Sep 17 00:00:00 2001 From: Reuben Grinberg Date: Sun, 1 Nov 2026 12:49:36 -0600 Subject: [PATCH] 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 --- src/ucm/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- 2.52.0