Change in ...osmo-msc[master]: gsm_04_11_gsup.c: fix broken reference counting for vsub

laforge gerrit-no-reply at
Thu Jun 20 16:54:46 UTC 2019

laforge has submitted this change and it was merged. ( )

Change subject: gsm_04_11_gsup.c: fix broken reference counting for vsub

gsm_04_11_gsup.c: fix broken reference counting for vsub

This change is similar to I5540556b1c75f6873883e46b78656f31fc1ef186.
In gsm411_gsup_rx() we do call vlr_subscr_find_by_imsi(), which
increases subscriber's reference count by one using the function
name as the token. However, we never release this token, so the
reference count grows on every received GSUP FORWARD-SM message.

Change-Id: Ic729beb5f94cbbfbb251bc9ab66a5e7b799286c0
M src/libmsc/gsm_04_11_gsup.c
1 file changed, 11 insertions(+), 4 deletions(-)

  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified

diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index 331092a..2abfc92 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -287,8 +287,10 @@
 int gsm411_gsup_rx(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg)
 	struct gsm_network *net = (struct gsm_network *) data;
-	struct vlr_subscr *vsub = vlr_subscr_find_by_imsi(net->vlr, gsup_msg->imsi, __func__);
+	struct vlr_subscr *vsub;
+	int rc;
+	vsub = vlr_subscr_find_by_imsi(net->vlr, gsup_msg->imsi, __func__);
 	if (!vsub) {
 		LOGP(DLSMS, LOGL_ERROR, "Rx %s for unknown subscriber, rejecting\n",
@@ -303,16 +305,21 @@
 		DEBUGP(DMSC, "Routed to GSM 04.11 MO handler\n");
-		return gsm411_gsup_mo_handler(net, vsub, gsup_msg);
+		rc = gsm411_gsup_mo_handler(net, vsub, gsup_msg);
+		break;
 	/* GSM 04.11 code implementing MT SMS */
 		DEBUGP(DMSC, "Routed to GSM 04.11 MT handler\n");
-		return gsm411_gsup_mt_handler(net, vsub, gsup_msg);
+		rc = gsm411_gsup_mt_handler(net, vsub, gsup_msg);
+		break;
 		LOGP(DMM, LOGL_ERROR, "No handler found for %s, dropping message...\n",
+	vlr_subscr_put(vsub, __func__);
+	return rc;

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ic729beb5f94cbbfbb251bc9ab66a5e7b799286c0
Gerrit-Change-Number: 14540
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <axilirator at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at>
Gerrit-Reviewer: neels <nhofmeyr 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