ALSA: control: Clear user-provided numid before adding a control
PATCH 1/1 ALSA: control: Clear user-provided numid before adding a control
Clear the user-provided numid before checking for duplicate controls.
A non-existing numid can cause the duplicate control ID check to be skipped, allowing a control with the same name and index to be added.
Since the kernel assigns the numid when adding a control, ignore the value provided by userspace.
--- sound/core/control.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/control.c +2 -1
@@ -1759,9 +1759,10 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,if (strnlen (info->id.name,sizeof (info->id.name)) >=sizeof (info->id.name))return -EINVAL ; + info->id.numid =0 ; +/* Delete a control to replace them if needed. */ if (replace) { - info->id.numid =0 ; err =snd_ctl_remove_user_ctl (file, &info->id);if (err)return err;
Signature · 1 line
2.55.0
Quoted 10 lines · Sreeraj S Kurup
Clear the user-provided numid before checking for duplicate controls.
A non-existing numid can cause the duplicate control ID check to be skipped, allowing a control with the same name and index to be added.
Since the kernel assigns the numid when adding a control, ignore the value provided by userspace.
Signed-off-by Sreeraj S Kurup <[email protected]>
Applied now. Thanks.
Takashi
Hi,
Thanks for applying the patch!
Best regards,
Sreeraj