[sr-dev] [kamailio/kamailio] dead lock of dialog module (Issue #3084)

progromm notifications at github.com
Wed Apr 13 12:29:32 CEST 2022


### Description

See `internal_get_dlg`: 
```C
static inline struct dlg_cell* internal_get_dlg(unsigned int h_entry,
        str* callid, str* ftag, str* ttag,
        unsigned int* dir, int mode)
{
    struct dlg_cell* dlg;
    struct dlg_entry* d_entry;

    d_entry = &(d_table->entries[h_entry]);

    dlg_lock(d_table, d_entry);

    for (dlg = d_entry->first ; dlg ; dlg = dlg->next) {
        /* Check callid / fromtag / totag */
        if (match_dialog(dlg, callid, ftag, ttag, dir) == 1) {
            ref_dlg_unsafe(dlg, 1);
            if (likely(mode == 0)) {
                dlg_unlock(d_table, d_entry);
            }
            LM_DBG("dialog callid='%.*s' found on entry %u, dir=%d\n",
                   callid->len, callid->s, h_entry, *dir);
            return dlg;
        }
    }

    if (likely(mode == 0)) {
        dlg_unlock(d_table, d_entry);
    }
    LM_DBG("no dialog callid='%.*s' found\n", callid->len, callid->s);
    return 0;
}
```
Should  judge whether `mode` is 0 before  `dlg_lock` .



-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3084
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3084 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220413/cee6f3dc/attachment-0001.htm>


More information about the sr-dev mailing list