Module: kamailio
Branch: master
Commit: 0546af13b8e6e8e0255e1dc4ea406956913ec288
URL: 
https://github.com/kamailio/kamailio/commit/0546af13b8e6e8e0255e1dc4ea406956913ec288

Author: Julien Chavanton <jchavan...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2017-01-05T16:32:31+01:00

dmq_usrloc: fix deadlock (#911)

* dmq_usrloc: fix deadlock

caused by acquiring the same lock twice using get_urecord_by_ruid and 
lock_udomain

* dmq_usrloc: get_urecord_by_ruid returns

 with the lock if the record was found

---

Modified: src/modules/dmq_usrloc/usrloc_sync.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/0546af13b8e6e8e0255e1dc4ea406956913ec288.diff
Patch: 
https://github.com/kamailio/kamailio/commit/0546af13b8e6e8e0255e1dc4ea406956913ec288.patch

---

diff --git a/src/modules/dmq_usrloc/usrloc_sync.c 
b/src/modules/dmq_usrloc/usrloc_sync.c
index 9b966d5..5a11e82 100644
--- a/src/modules/dmq_usrloc/usrloc_sync.c
+++ b/src/modules/dmq_usrloc/usrloc_sync.c
@@ -62,8 +62,6 @@ static int add_contact(str aor, ucontact_info_t* ci)
                return -1;
        }
 
-       dmq_ul.lock_udomain(_d, &aor);
-
        LM_DBG("aor: %.*s\n", aor.len, aor.s);
        LM_DBG("ci->ruid: %.*s\n", ci->ruid.len, ci->ruid.s);
        LM_DBG("aorhash: %i\n", dmq_ul.get_aorhash(&aor));
@@ -81,6 +79,8 @@ static int add_contact(str aor, ucontact_info_t* ci)
                        return 0;
                }
        }
+
+       dmq_ul.lock_udomain(_d, &aor);
        res = dmq_ul.get_urecord(_d, &aor, &r);
        if (res < 0) {
                LM_ERR("failed to retrieve record from usrloc\n");


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to