Harald Welte has submitted this change and it was merged.

Change subject: more robust usage of osmo_timer API for osmo-hlr luop timer
......................................................................


more robust usage of osmo_timer API for osmo-hlr luop timer

Use osmo_timer_setup() to set up the luop timer, instead of
settting the timer up manually.

Delete the timer before the luop is freed to prevent a potential
crash in case the timer is already armed and the function call
chain leading up to lu_op_free() does not cancel the timer.

Found while studying code to prepare work on issue OS#2785.

This change has been tested with 'make check' and TTCN3 HLR tests.

Related: OS#2785
Change-Id: I1a7596675b2d94217895f0f3d3f67b86ef123c2e
---
M src/luop.c
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/luop.c b/src/luop.c
index 4ef4ea3..02c41d0 100644
--- a/src/luop.c
+++ b/src/luop.c
@@ -108,8 +108,7 @@
        luop = talloc_zero(srv, struct lu_operation);
        OSMO_ASSERT(luop);
        luop->gsup_server = srv;
-       luop->timer.cb = lu_op_timer_cb;
-       luop->timer.data = luop;
+       osmo_timer_setup(&luop->timer, lu_op_timer_cb, luop);
 
        return luop;
 }
@@ -119,6 +118,10 @@
        /* Only attempt to remove when it was ever added to a list. */
        if (luop->list.next)
                llist_del(&luop->list);
+
+       /* Delete timer just in case it is still pending. */
+       osmo_timer_del(&luop->timer);
+
        talloc_free(luop);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/7587
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1a7596675b2d94217895f0f3d3f67b86ef123c2e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-hlr
Gerrit-Branch: master
Gerrit-Owner: Stefan Sperling <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder

Reply via email to