From d19fb1b66064a2a730f04e12b71e9a5cfe30a6de Mon Sep 17 00:00:00 2001 From: Razvan Crainea Date: Mon, 8 Aug 2022 15:48:21 +0300 Subject: [PATCH] b2b_entities: fix possible deadlock Fix deadlock generated when a dialog is terminated on the 200 OK callback --- modules/b2b_entities/dlg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/b2b_entities/dlg.c b/modules/b2b_entities/dlg.c index e19f7c43a9d..5e9484cc8df 100644 --- a/modules/b2b_entities/dlg.c +++ b/modules/b2b_entities/dlg.c @@ -3395,8 +3395,10 @@ void b2b_tm_cback(struct cell *t, b2b_table htable, struct tmcb_params *ps) b2b_ev = B2B_EVENT_UPDATE; b2b_run_cb(dlg, hash_index, etype, B2BCB_TRIGGER_EVENT, b2b_ev, &storage, serialize_backend); - } else + } else { b2b_ev = -1; + B2BE_LOCK_RELEASE(htable, hash_index); + } } else if (b2b_ev == B2B_EVENT_CREATE) { B2BE_LOCK_GET(htable, hash_index); @@ -3406,8 +3408,10 @@ void b2b_tm_cback(struct cell *t, b2b_table htable, struct tmcb_params *ps) if (b2be_db_mode == WRITE_THROUGH) b2be_db_insert(dlg, etype); - } else + } else { b2b_ev = -1; + B2BE_LOCK_RELEASE(htable, hash_index); + } } }