From: Takashi Sakamoto Date: Fri, 13 Nov 2020 09:20:43 +0000 (+0900) Subject: ALSA: ctl: fix error path at adding user-defined element set X-Git-Tag: Ubuntu-5.10.0-12.13~1398^2~7 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=95a793c3bc75cf888e0e641d656e7d080f487d8b;p=mirror_ubuntu-hirsute-kernel.git ALSA: ctl: fix error path at adding user-defined element set When processing request to add/replace user-defined element set, check of given element identifier and decision of numeric identifier is done in "__snd_ctl_add_replace()" helper function. When the result of check is wrong, the helper function returns error code. The error code shall be returned to userspace application. Current implementation includes bug to return zero to userspace application regardless of the result. This commit fixes the bug. Cc: Fixes: e1a7bfe38079 ("ALSA: control: Fix race between adding and removing a user element") Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20201113092043.16148-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai --- diff --git a/sound/core/control.c b/sound/core/control.c index 4373de42a5a0..3b44378b9dec 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -1539,7 +1539,7 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, unlock: up_write(&card->controls_rwsem); - return 0; + return err; } static int snd_ctl_elem_add_user(struct snd_ctl_file *file,