]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: ctl: Fix copy of updated id with element read/write
authorAlan Young <consult.awy@gmail.com>
Thu, 2 Dec 2021 15:06:07 +0000 (15:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Dec 2021 09:03:49 +0000 (10:03 +0100)
commite35ddb1f575d584db3b97c920286ddc492512ea4
tree6b2cd7d4c4e78c5701d7f5bbeab8a6b9d2f69c6e
parent386203c652a3ace33fe268c0a6e3b9c573852ec3
ALSA: ctl: Fix copy of updated id with element read/write

commit b6409dd6bdc03aa178bbff0d80db2a30d29b63ac upstream.

When control_compat.c:copy_ctl_value_to_user() is used, by
ctl_elem_read_user() & ctl_elem_write_user(), it must also copy back the
snd_ctl_elem_id value that may have been updated (filled in) by the call
to snd_ctl_elem_read/snd_ctl_elem_write().

This matches the functionality provided by snd_ctl_elem_read_user() and
snd_ctl_elem_write_user(), via snd_ctl_build_ioff().

Without this, and without making additional calls to snd_ctl_info()
which are unnecessary when using the non-compat calls, a userspace
application will not know the numid value for the element and
consequently will not be able to use the poll/read interface on the
control file to determine which elements have updates.

Signed-off-by: Alan Young <consult.awy@gmail.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211202150607.543389-1-consult.awy@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/core/control_compat.c