]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ALSA: ctl: allow TLV read operation for callback type of element in locked case
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 23 Dec 2019 09:33:47 +0000 (18:33 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Feb 2020 07:36:24 +0000 (08:36 +0100)
commitc324effa6d9d2da61ef35ae14d43209dc556ea8b
treebd3e1f27ccf972353bef7bf772774d87a0f5e90e
parent4125714ce1d63352227249ac92ae1d04587e1ad7
ALSA: ctl: allow TLV read operation for callback type of element in locked case

[ Upstream commit d61fe22c2ae42d9fd76c34ef4224064cca4b04b0 ]

A design of ALSA control core allows applications to execute three
operations for TLV feature; read, write and command. Furthermore, it
allows driver developers to process the operations by two ways; allocated
array or callback function. In the former, read operation is just allowed,
thus developers uses the latter when device driver supports variety of
models or the target model is expected to dynamically change information
stored in TLV container.

The core also allows applications to lock any element so that the other
applications can't perform write operation to the element for element
value and TLV information. When the element is locked, write and command
operation for TLV information are prohibited as well as element value.
Any read operation should be allowed in the case.

At present, when an element has callback function for TLV information,
TLV read operation returns EPERM if the element is locked. On the
other hand, the read operation is success when an element has allocated
array for TLV information. In both cases, read operation is success for
element value expectedly.

This commit fixes the bug. This change can be backported to v4.14
kernel or later.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20191223093347.15279-1-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/core/control.c