Skip to content

Commit 728eff0

Browse files
committed
[dialog] fix missing locking in get_dlg_vals()
Iterating the list of dlg vals must be done under lock
1 parent 244cc92 commit 728eff0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/dialog/dialog.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,8 @@ static int w_get_dlg_vals(struct sip_msg *msg, pv_spec_t *v_name,
14231423
/* dlg found - NOTE you have a ref! */
14241424
LM_DBG("dialog found, fetching all variable\n");
14251425

1426+
dlg_lock_dlg( dlg );
1427+
14261428
/* iterate the list with all the dlg variables */
14271429
for( dv=dlg->vals ; dv ; dv=dv->next) {
14281430

@@ -1438,13 +1440,15 @@ static int w_get_dlg_vals(struct sip_msg *msg, pv_spec_t *v_name,
14381440
if ( pv_set_value( msg, v_val, 0, &val)<0 ) {
14391441
LM_ERR("failed to add new value in dlg val list, ignoring\n");
14401442
/* better exit here, as we will desync the lists */
1443+
dlg_unlock_dlg( dlg );
14411444
unref_dlg(dlg, 1);
14421445
return -1;
14431446
}
14441447
}
14451448

14461449
}
14471450

1451+
dlg_unlock_dlg( dlg );
14481452
unref_dlg(dlg, 1);
14491453

14501454
return 1;

0 commit comments

Comments
 (0)