Browse Source

TT#14008 add missing DTLS locks

fixes possible segfaults due to race conditions

fixes #283

Change-Id: I7efba57d914163986c294b8fb1dd9531d5ef7a89
changes/38/12638/2
Richard Fuchs 9 years ago
parent
commit
5e3ce30272
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      daemon/dtls.c

+ 10
- 1
daemon/dtls.c View File

@ -680,13 +680,22 @@ int dtls(struct packet_stream *ps, const str *s, const endpoint_t *fsin) {
}
else if (ret == 1) {
/* connected! */
mutex_lock(&ps->out_lock); // nested lock!
if (dtls_setup_crypto(ps, d))
/* XXX ?? */ ;
mutex_unlock(&ps->out_lock);
if (PS_ISSET(ps, RTP) && PS_ISSET(ps, RTCP) && ps->rtcp_sibling
&& MEDIA_ISSET(ps->media, RTCP_MUX))
&& MEDIA_ISSET(ps->media, RTCP_MUX)
&& ps->rtcp_sibling != ps)
{
// nested locks!
mutex_lock(&ps->rtcp_sibling->in_lock);
mutex_lock(&ps->rtcp_sibling->out_lock);
if (dtls_setup_crypto(ps->rtcp_sibling, d))
/* XXX ?? */ ;
mutex_unlock(&ps->rtcp_sibling->out_lock);
mutex_unlock(&ps->rtcp_sibling->in_lock);
}
}


Loading…
Cancel
Save