Changeset 3545


Ignore:
Timestamp:
Apr 27, 2011 3:05:26 AM (9 years ago)
Author:
bennylp
Message:

Fixed #1247: Deadlock potential in sip_regc.c if sending fails (thank you Alejandro Orellana for the report)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip-ua/sip_reg.c

    r3544 r3545  
    992992} 
    993993 
    994 static void tsx_callback(void *token, pjsip_event *event) 
     994static void regc_tsx_callback(void *token, pjsip_event *event) 
    995995{ 
    996996    pj_status_t status; 
     
    12521252    pjsip_tx_data_add_ref(tdata); 
    12531253 
     1254    /* Need to unlock the regc temporarily while sending the message to 
     1255     * prevent deadlock (https://trac.pjsip.org/repos/ticket/1247). 
     1256     * It should be safe to do this since the regc's refcount has been 
     1257     * incremented. 
     1258     */ 
     1259    pj_lock_release(regc->lock); 
     1260 
     1261    /* Now send the message */ 
    12541262    status = pjsip_endpt_send_request(regc->endpt, tdata, REGC_TSX_TIMEOUT, 
    1255                                       regc, &tsx_callback); 
     1263                                      regc, &regc_tsx_callback); 
    12561264    if (status!=PJ_SUCCESS) { 
    12571265        PJ_LOG(4,(THIS_FILE, "Error sending request, status=%d", status)); 
    12581266    } 
     1267 
     1268    /* Reacquire the lock */ 
     1269    pj_lock_acquire(regc->lock); 
    12591270 
    12601271    /* Get last transport used and add reference to it */ 
Note: See TracChangeset for help on using the changeset viewer.