Change in osmo-msc[master]: vlr_sgs: Balance use_count incremented in vlr_sgs_loc_update

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at

pespin gerrit-no-reply at
Wed Aug 25 10:14:38 UTC 2021

pespin has submitted this change. ( )

Change subject: vlr_sgs: Balance use_count incremented in vlr_sgs_loc_update

vlr_sgs: Balance use_count incremented in vlr_sgs_loc_update

During a recent pcap trace, it was spotted that subscriber coming from
SGs had a use count with 16 "SGs" items, and later it incremented to 17.
Further investigation shows that the related use_count item was never
decreased, meaning every time an SGs-LU was sent by the MME, the item
was incremented further and never decremented.

Let's rename the item to be referenced while in LU, and then decremented
when LU is done. At that time, either the LU was accepted and the
subscriber object has a use_count item "attached", or it was rejected
and we already sent the reject messages, so we are fine deleting it if

Related: SYS#5337
Change-Id: I22c386f02ffa57428f700b003cc2cf23133598d0
M include/osmocom/msc/vlr_sgs.h
M src/libvlr/vlr_sgs.c
2 files changed, 7 insertions(+), 2 deletions(-)

  Jenkins Builder: Verified
  dexter: Looks good to me, but someone else must approve
  osmith: Looks good to me, approved

diff --git a/include/osmocom/msc/vlr_sgs.h b/include/osmocom/msc/vlr_sgs.h
index 05e062b..7231449 100644
--- a/include/osmocom/msc/vlr_sgs.h
+++ b/include/osmocom/msc/vlr_sgs.h
@@ -26,7 +26,7 @@
 struct vlr_subscr;
 struct vlr_instance;
-#define VSUB_USE_SGS "SGs"
+#define VSUB_USE_SGS_LU "SGs-lu"
 #define VSUB_USE_SGS_PAGING_REQ "SGs-paging-req"
 /* See also 3GPP TS 29.118, chapter 4.2.2 States at the VLR */
diff --git a/src/libvlr/vlr_sgs.c b/src/libvlr/vlr_sgs.c
index 6421581..61db585 100644
--- a/src/libvlr/vlr_sgs.c
+++ b/src/libvlr/vlr_sgs.c
@@ -83,7 +83,7 @@
-	vsub = vlr_subscr_find_or_create_by_imsi(vlr, imsi, VSUB_USE_SGS, NULL);
+	vsub = vlr_subscr_find_or_create_by_imsi(vlr, imsi, VSUB_USE_SGS_LU, NULL);
 	if (!vsub) {
 		LOGP(DSGS, LOGL_ERROR, "VLR subscriber allocation failed\n");
 		return -EINVAL;
@@ -119,6 +119,9 @@
 	osmo_fsm_inst_dispatch(vsub->sgs_fsm, SGS_UE_E_TX_LU_ACCEPT, NULL);
+	/* Balance vlr_subscr_find_or_create_by_imsi() in vlr_sgs_loc_update() */
+	vlr_subscr_put(vsub, VSUB_USE_SGS_LU);
 	/* FIXME: At this point we need to check the status of Ts5 and if
 	 * it is still running this means the LU has interrupted the paging,
 	 * and we need to start paging again. 3GPP TS 29.118,
@@ -130,6 +133,8 @@
 void vlr_sgs_loc_update_rej_sent(struct vlr_subscr *vsub)
 	osmo_fsm_inst_dispatch(vsub->sgs_fsm, SGS_UE_E_TX_LU_REJECT, NULL);
+	/* Balance vlr_subscr_find_or_create_by_imsi() in vlr_sgs_loc_update() */
+	vlr_subscr_put(vsub, VSUB_USE_SGS_LU);
 /*! Perform an SGs IMSI detach.

To view, visit
To unsubscribe, or for help writing mail filters, visit

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: I22c386f02ffa57428f700b003cc2cf23133598d0
Gerrit-Change-Number: 25236
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at>
Gerrit-Reviewer: neels <nhofmeyr at>
Gerrit-Reviewer: osmith <osmith at>
Gerrit-Reviewer: pespin <pespin at>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gerrit-log mailing list