[sr-dev] [SR-Users] Possible locking issue in usrloc module in file udomain.c

Rupesh Kumar rupesh_kumar at sbcglobal.net
Wed Sep 18 23:11:09 CEST 2019


 Perfect, thanks Henning !.

    On Wednesday, September 18, 2019, 1:45:45 PM PDT, Henning Westerholt <hw at skalatan.de> wrote:  
 
 
Hello Rupesh,

the lock mode was changed, you find the reasoning (and the linked commit) in this issue:

https://github.com/kamailio/kamailio/issues/577

Cheers,

Henning

Am 18.09.19 um 22:05 schrieb Rupesh Kumar:

Hi ,
Currently I am running kamailio 4.2 and now upgrading to kamailio 5.2 and was just going thru the changes.

In the file modules/usrloc/udomain.c inside the function free_udomain( ) , it appears that we are not protecting via lock_ulslot and unlock_ulslot doing free. Could it cause some race condition ?
May be its intentional but going thru the github history its there since day 1. I checked all branches in kamailio 4.x and we have the protection.
In 4.x 

void free_udomain(udomain_t* _d)
{
    int i;
    
    if (_d->table) {
        for(i = 0; i < _d->size; i++) {
            lock_ulslot(_d, i);
            deinit_slot(_d->table + i);
            unlock_ulslot(_d, i);
        }
        shm_free(_d->table);
    }    shm_free(_d);
}
In 5.x
void free_udomain(udomain_t* _d)
{
    int i;
    
    if (_d->table) {
        for(i = 0; i < _d->size; i++) {
            deinit_slot(_d->table + i);
        }
        shm_free(_d->table);
    }
    shm_free(_d);
}


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users at lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Kamailio Merchandising - https://skalatan.de/merchandising/
Kamailio services - https://skalatan.de/services
Henning Westerholt - https://skalatan.de/blog/  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190918/defc7a26/attachment.html>


More information about the sr-dev mailing list