From 72ef7d8bb07bc4e938a242bfdd9d0e45f77fc917 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 26 Mar 2024 01:43:53 +0100 Subject: [PATCH] invalidate vsub->msc_conn_ref when msc_a is discarded We have an msc_conn_ref pointer from vlr_subscr to an active msc_a instance. So far, we just keep it pointing at discarded memory. Instead, make sure it goes back to NULL when the msc_a instance deallocates. This way the VLR can reliably tell whether a given VLR entry still has an active connection or is just inactively caching the subscriber. Related: SYS#6860 OS#4721 Change-Id: Ic63d01d220b63453976fe06a7c6b606f97172c99 --- src/libmsc/msc_a.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libmsc/msc_a.c b/src/libmsc/msc_a.c index 4fb30c46c..70d9bf74f 100644 --- a/src/libmsc/msc_a.c +++ b/src/libmsc/msc_a.c @@ -999,6 +999,7 @@ static void msc_a_fsm_released(struct osmo_fsm_inst *fi, uint32_t event, void *d void msc_a_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) { struct msc_a *msc_a = msc_a_fi_priv(fi); + struct vlr_subscr *vsub = msc_a_vsub(msc_a); trans_conn_closed(msc_a); @@ -1006,6 +1007,10 @@ void msc_a_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) LOG_MSC_A(msc_a, LOGL_ERROR, "Deallocating active transactions failed\n"); LOG_MSC_A_CAT(msc_a, DREF, LOGL_DEBUG, "max total use count was %d\n", msc_a->max_total_use_count); + + /* Invalidate the active conn in VLR subscriber state, if any. */ + if (vsub && vsub->msc_conn_ref == msc_a) + vsub->msc_conn_ref = NULL; } const struct value_string msc_a_fsm_event_names[] = {