pcm: direct plugins: do more safe IPC semaphore handling

As reported dead-lock, do local lock counting and invoke abort() when
the lock counts do not match at close() time.

Reported-by: <mateen abdulmateen.shaikh@gmail.com>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2013-04-09 14:31:20 +02:00
parent b6eb0f9bfd
commit a6813c2d0e
4 changed files with 28 additions and 12 deletions

View file

@ -781,9 +781,9 @@ static int snd_pcm_dmix_close(snd_pcm_t *pcm)
shm_sum_discard(dmix);
if (snd_pcm_direct_shm_discard(dmix)) {
if (snd_pcm_direct_semaphore_discard(dmix))
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT);
} else
snd_pcm_direct_semaphore_up(dmix, DIRECT_IPC_SEM_CLIENT);
snd_pcm_direct_semaphore_final(dmix, DIRECT_IPC_SEM_CLIENT);
free(dmix->bindings);
pcm->private_data = NULL;
free(dmix);