]> git.alsa-project.org Git - alsa-lib.git/commit
pcm: direct: Protect from freeing semaphore when already in use
authorJoshua Frkuska <joshua_frkuska@mentor.com>
Fri, 25 Nov 2016 10:13:40 +0000 (15:43 +0530)
committerTakashi Iwai <tiwai@suse.de>
Mon, 28 Nov 2016 19:13:36 +0000 (20:13 +0100)
commit2dd78251ff0c4009b478574cca7aef2eb05c2279
treecda24d1648c8c18381dc2dc99afe4619a84f9f30
parent2ef7a53c31de47f5f33127a89054a661a31bd310
pcm: direct: Protect from freeing semaphore when already in use

In the case of dshare, dsnoop, and dmix when a device is opened twice
and fails the second time, the semaphore is completely discarded. This
creates dangling semaphore data.

This patch removes the possibility for the semaphore to be destroyed during
a typical open failure by first checking if the shared memory can be destroyed
or not. If the shared memory cannot be released it means both it and the
semaphore are still in use and therefore the semaphore is just released.

Signed-off-by: Joshua Frkuska <joshua_frkuska@mentor.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_dmix.c
src/pcm/pcm_dshare.c
src/pcm/pcm_dsnoop.c