mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-07 13:30:07 -05:00
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:
parent
b6eb0f9bfd
commit
a6813c2d0e
4 changed files with 28 additions and 12 deletions
|
|
@ -470,10 +470,11 @@ static int snd_pcm_dshare_close(snd_pcm_t *pcm)
|
|||
snd_pcm_direct_server_discard(dshare);
|
||||
if (dshare->client)
|
||||
snd_pcm_direct_client_discard(dshare);
|
||||
if (snd_pcm_direct_shm_discard(dshare))
|
||||
snd_pcm_direct_semaphore_discard(dshare);
|
||||
else
|
||||
snd_pcm_direct_semaphore_up(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
if (snd_pcm_direct_shm_discard(dshare)) {
|
||||
if (snd_pcm_direct_semaphore_discard(dshare))
|
||||
snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
} else
|
||||
snd_pcm_direct_semaphore_final(dshare, DIRECT_IPC_SEM_CLIENT);
|
||||
free(dshare->bindings);
|
||||
pcm->private_data = NULL;
|
||||
free(dshare);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue