Hi,
On 2017年08月04日 23:52, Takashi Iwai wrote:
On Thu, 03 Aug 2017 13:20:39 +0200, Takashi Sakamoto wrote:
Hi,
In a design of ALSA control core, each set of elements have data of Type-Length-Value shape. This is called as TLV data. In ALSA control interface, applications can three types of requests to elements about TLV data; read, write and command.
In current implementation of ALSA control core, these three requests are handled with read lock of a counting semaphore. However, this has an issue of concurrent access because in theory write/command requests have sub-effects to change state of the set of elements in a point of TLV data. Read requests and write/command requests are handled exclusively as well as each write/command requests.
This patchset is for this purpose. Additionally, this applies code refactoring to TLV ioctl handler and TLV handler for user-defined element set so that they get better shape for readers.
Taking the rw mutex outside snd_ctl_tlv_ioctl() is a good idea. It simplified things a lot, indeed.
Now applied all patches. Thanks!
Thanks. But I found that commit 30d8340b5857 ("ALSA: control: obsolete user_ctl_lock") brought another concurrent access issue between ELEM_READ/ELEM_WRITE for user-defined element sets, due to a generic bug in handlers of these two requests in ALSA control core. I pushed my commits into my repository to fix this. The latest three commits. https://github.com/takaswie/sound/commits/topic/fix-ctl-writelock
I'll post them after enough tests.
Thanks
Takashi Sakamoto