Module: kamailio
Branch: master
Commit: 4183b860e8af6d65074ab98a996c187211aebc7f
URL:
https://github.com/kamailio/kamailio/commit/4183b860e8af6d65074ab98a996c187…
Author: Patrick Wakano <patrick.wakano(a)ipscape.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-12-02T13:58:18+01:00
dialog: access dialog table entry by reference for dmq_send_all_dlgs
- avoid race conditions to get and release the lock when entry structure
is copied in local variable
- GH #2570, GH #2547
---
Modified: src/modules/dialog/dlg_dmq.c
---
Diff:
https://github.com/kamailio/kamailio/commit/4183b860e8af6d65074ab98a996c187…
Patch:
https://github.com/kamailio/kamailio/commit/4183b860e8af6d65074ab98a996c187…
---
diff --git a/src/modules/dialog/dlg_dmq.c b/src/modules/dialog/dlg_dmq.c
index 9f70354d50..38dc105fb8 100644
--- a/src/modules/dialog/dlg_dmq.c
+++ b/src/modules/dialog/dlg_dmq.c
@@ -646,22 +646,22 @@ int dlg_dmq_replicate_action(dlg_dmq_action_t action, dlg_cell_t*
dlg,
int dmq_send_all_dlgs(dmq_node_t* dmq_node) {
int index;
- dlg_entry_t entry;
+ dlg_entry_t *entry;
dlg_cell_t *dlg;
LM_DBG("sending all dialogs \n");
for(index = 0; index< d_table->size; index++){
/* lock the whole entry */
- entry = (d_table->entries)[index];
- dlg_lock( d_table, &entry);
+ entry = &d_table->entries[index];
+ dlg_lock( d_table, entry);
- for(dlg = entry.first; dlg != NULL; dlg = dlg->next){
+ for(dlg = entry->first; dlg != NULL; dlg = dlg->next){
dlg->dflags |= DLG_FLAG_CHANGED_PROF;
dlg_dmq_replicate_action(DLG_DMQ_UPDATE, dlg, 0, dmq_node);
}
- dlg_unlock( d_table, &entry);
+ dlg_unlock( d_table, entry);
}
return 0;